Skip to content

Commit

Permalink
Update tests from upstream/main to verify new behavior.
Browse files Browse the repository at this point in the history
This branch changed RelevanceQuery.build to throw SyntaxCheckException
if it is called with less than two arguments.

Previously, build would through SemanticCheckException.

Signed-off-by: MaxKsyunz <maxk@bitquilltech.com>
  • Loading branch information
MaxKsyunz committed May 21, 2022
1 parent 80f0deb commit 15775e8
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import org.opensearch.sql.common.antlr.SyntaxCheckException;
import org.opensearch.sql.data.model.ExprValue;
import org.opensearch.sql.data.type.ExprType;
import org.opensearch.sql.exception.SemanticCheckException;
Expand Down Expand Up @@ -110,16 +111,16 @@ public void test_valid_parameters(List<Expression> validArgs) {
}

@Test
public void test_SemanticCheckException_when_no_arguments() {
public void test_SyntaxCheckException_when_no_arguments() {
List<Expression> arguments = List.of();
assertThrows(SemanticCheckException.class,
assertThrows(SyntaxCheckException.class,
() -> matchQuery.build(new MatchExpression(arguments)));
}

@Test
public void test_SemanticCheckException_when_one_argument() {
public void test_SyntaxCheckException_when_one_argument() {
List<Expression> arguments = List.of(namedArgument("field", "field_value"));
assertThrows(SemanticCheckException.class,
assertThrows(SyntaxCheckException.class,
() -> matchQuery.build(new MatchExpression(arguments)));
}

Expand Down

0 comments on commit 15775e8

Please sign in to comment.