@@ -84,7 +84,7 @@ public class MLUpdateModelInputTest {
84
84
"{\" model_type\" :\" testModelType\" ,\" embedding_dimension\" :100,\" framework_type\" :\" SENTENCE_TRANSFORMERS\" ,\" all_config\" :\" "
85
85
+
86
86
"{\\ \" field1\\ \" :\\ \" value1\\ \" ,\\ \" field2\\ \" :\\ \" value2\\ \" }\" },\" connector_id\" :" +
87
- "\" test-connector_id\" , \" interface \" :{} }" ;
87
+ "\" test-connector_id\" }" ;
88
88
89
89
@ Rule
90
90
public ExpectedException exceptionRule = ExpectedException .none ();
@@ -166,30 +166,16 @@ public void readInputStreamSuccessWithNullFields() throws IOException {
166
166
@ Test
167
167
public void testToXContent () throws Exception {
168
168
String jsonStr = serializationWithToXContent (updateModelInput );
169
- assertEquals ("{}" , jsonStr );
170
- }
171
-
172
- @ Test
173
- public void testToXContentForUpdateRequestDoc () throws Exception {
174
- String jsonStr = serializationWithToXContentForUpdateRequestDoc (updateModelInput );
175
169
assertEquals (expectedOutputStrForUpdateRequestDoc , jsonStr );
176
170
}
177
171
178
- @ Test
179
- public void testToXContenttForUpdateRequestDocIncomplete () throws Exception {
180
- String expectedIncompleteInputStr = "{\" model_id\" :\" test-model_id\" }" ;
181
- updateModelInput = MLUpdateModelInput .builder ()
182
- .modelId ("test-model_id" ).build ();
183
- String jsonStr = serializationWithToXContentForUpdateRequestDoc (updateModelInput );
184
- assertEquals (expectedIncompleteInputStr , jsonStr );
185
- }
186
-
187
172
@ Test
188
173
public void testToXContentIncomplete () throws Exception {
174
+ String expectedIncompleteInputStr = "{\" model_id\" :\" test-model_id\" }" ;
189
175
updateModelInput = MLUpdateModelInput .builder ()
190
176
.modelId ("test-model_id" ).build ();
191
177
String jsonStr = serializationWithToXContent (updateModelInput );
192
- assertEquals ("{}" , jsonStr );
178
+ assertEquals (expectedIncompleteInputStr , jsonStr );
193
179
}
194
180
195
181
@ Test
@@ -238,7 +224,7 @@ public void parseWithIllegalFieldWithoutModel() throws Exception {
238
224
"\" test-connector_id\" ,\" connector\" :{\" description\" :\" updated description\" ,\" version\" :\" 1\" },\" last_updated_time\" :1,\" illegal_field\" :\" This field need to be skipped.\" }" ;
239
225
testParseFromJsonString (expectedInputStrWithIllegalField , parsedInput -> {
240
226
try {
241
- assertEquals (expectedOutputStr , serializationWithToXContentForUpdateRequestDoc (parsedInput ));
227
+ assertEquals (expectedOutputStr , serializationWithToXContent (parsedInput ));
242
228
} catch (IOException e ) {
243
229
throw new RuntimeException (e );
244
230
}
@@ -268,10 +254,4 @@ private String serializationWithToXContent(MLUpdateModelInput input) throws IOEx
268
254
return builder .toString ();
269
255
}
270
256
271
- private String serializationWithToXContentForUpdateRequestDoc (MLUpdateModelInput input ) throws IOException {
272
- XContentBuilder builder = XContentFactory .jsonBuilder ();
273
- input .toXContentForUpdateRequestDoc (builder , ToXContent .EMPTY_PARAMS );
274
- assertNotNull (builder );
275
- return builder .toString ();
276
- }
277
257
}
0 commit comments