Repository navigation
Adding Match Query Unit Tests - #56
Conversation
… avoid NoSuchElementException in MatchQuery Signed-off-by: forestmvey <[email protected]>
Signed-off-by: forestmvey <[email protected]>
Signed-off-by: forestmvey <[email protected]>
Codecov Report
@@ Coverage Diff @@
## integ-match_query_unit_tests #56 +/- ##
===============================================================
Coverage 97.67% 97.67%
- Complexity 2743 2744 +1
===============================================================
Files 266 266
Lines 6797 6799 +2
Branches 433 433
===============================================================
+ Hits 6639 6641 +2
Misses 157 157
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
…ng exceptions and moved private method definition placement below public methods Signed-off-by: forestmvey <[email protected]>
|
@forestmvey, |
… Fixed checkstyle syntax errors. Signed-off-by: forestmvey <[email protected]>
Signed-off-by: forestmvey <[email protected]>
|
|
||
| static Stream<List<Expression>> generateValidData() { | ||
| final DSL dsl = new ExpressionConfig().dsl(new ExpressionConfig().functionRepository()); | ||
| return Stream.of( |
There was a problem hiding this comment.
Looks good to me.
Another option is to take the list of valid args and build the stream of test cases from it.
Something like:
NamedArgument field = dsl.namedArgument("field", DSL.literal("field_value"));
NamedArgument query = dsl.namedArgument("query", DSL.literal("query_value"));
return List.of(
dsl.namedArgument("analyzer", "standard"),
dsl.namedArgument("auto_generate_synonyms_phrase_query", "true"),
dsl.namedArgument("fuzziness", "AUTO"),
dsl.namedArgument("max_expansions", "50"),
dsl.namedArgument("prefix_length", "0"),
dsl.namedArgument("fuzzy_transpositions", "true"),
dsl.namedArgument("fuzzy_rewrite", "constant_score"),
dsl.namedArgument("lenient", "false"),
dsl.namedArgument("operator", "OR"),
dsl.namedArgument("minimum_should_match", "3"),
dsl.namedArgument("zero_terms_query", "NONE"),
dsl.namedArgument("boost", "1"))
.stream().map(arg -> List.of(field, query, arg));
build_succeeds_with_two_arguments would need to be kept.
| return Stream.of( | ||
| List.of( | ||
| dsl.namedArgument("field", DSL.literal("field_value")), | ||
| dsl.namedArgument("query", DSL.literal("query_value")) |
There was a problem hiding this comment.
you could create
NamedArgument fieldArgument = dsl.namedArgument("field", DSL.literal("field_value"));
NamedArgument queryArgument = dsl.namedArgument("query", DSL.literal("query_value"));
once and pass it to all these lists. If you make it static and global to the class, you can use it in other tests ;)
Description
Add unit tests for match function implementation with 100% code coverage.
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.