Skip to content

Commit

Permalink
fix ut
Browse files Browse the repository at this point in the history
Signed-off-by: zhichao-aws <zhichaog@amazon.com>
  • Loading branch information
zhichao-aws committed Nov 22, 2023
1 parent daef81e commit f52c443
Showing 1 changed file with 0 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void testFromXContent_whenBuiltWithOptionals_thenBuildSuccessfully() {
"VECTOR_FIELD": {
"query_text": "string",
"model_id": "string",
"max_token_score": 123.0,
"boost": 10.0,
"_name": "something",
}
Expand All @@ -99,7 +98,6 @@ public void testFromXContent_whenBuiltWithOptionals_thenBuildSuccessfully() {
.startObject(FIELD_NAME)
.field(QUERY_TEXT_FIELD.getPreferredName(), QUERY_TEXT)
.field(MODEL_ID_FIELD.getPreferredName(), MODEL_ID)
.field(MAX_TOKEN_SCORE_FIELD.getPreferredName(), MAX_TOKEN_SCORE)
.field(BOOST_FIELD.getPreferredName(), BOOST)
.field(NAME_FIELD.getPreferredName(), QUERY_NAME)
.endObject()
Expand All @@ -112,7 +110,6 @@ public void testFromXContent_whenBuiltWithOptionals_thenBuildSuccessfully() {
assertEquals(FIELD_NAME, sparseEncodingQueryBuilder.fieldName());
assertEquals(QUERY_TEXT, sparseEncodingQueryBuilder.queryText());
assertEquals(MODEL_ID, sparseEncodingQueryBuilder.modelId());
assertEquals(MAX_TOKEN_SCORE, sparseEncodingQueryBuilder.maxTokenScore(), 0.0);
assertEquals(BOOST, sparseEncodingQueryBuilder.boost(), 0.0);
assertEquals(QUERY_NAME, sparseEncodingQueryBuilder.queryName());
}
Expand Down Expand Up @@ -193,30 +190,6 @@ public void testFromXContent_whenBuildWithMissingQuery_thenFail() {
expectThrows(IllegalArgumentException.class, () -> NeuralSparseQueryBuilder.fromXContent(contentParser));
}

@SneakyThrows
public void testFromXContent_whenBuildWithNegativeMaxTokenScore_thenFail() {
/*
{
"VECTOR_FIELD": {
"query_text": "string",
"model_id": "string",
"max_token_score": -1
}
}
*/
XContentBuilder xContentBuilder = XContentFactory.jsonBuilder()
.startObject()
.startObject(FIELD_NAME)
.field(MODEL_ID_FIELD.getPreferredName(), MODEL_ID)
.field(MAX_TOKEN_SCORE_FIELD.getPreferredName(), -1f)
.endObject()
.endObject();

XContentParser contentParser = createParser(xContentBuilder);
contentParser.nextToken();
expectThrows(IllegalArgumentException.class, () -> NeuralSparseQueryBuilder.fromXContent(contentParser));
}

@SneakyThrows
public void testFromXContent_whenBuildWithMissingModelId_thenFail() {
/*
Expand Down

0 comments on commit f52c443

Please sign in to comment.