Skip to content

Commit

Permalink
Adding test for execption with GET for invokeModel
Browse files Browse the repository at this point in the history
Signed-off-by: TrungBui59 <[email protected]>
  • Loading branch information
TrungBui59 committed Nov 21, 2023
1 parent 8d9ff2f commit 4de4d40
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ public void invokeRemoteModel_POSTMethodErrorPath() {
executor.invokeRemoteModel(null, null, null, null);
}

@Test
public void invokeRemoteModel_GETMethodErrorPath() {
exceptionRule.expect(MLException.class);
exceptionRule.expectMessage("Failed to create http request for remote model");

ConnectorAction predictAction = ConnectorAction.builder()
.actionType(ConnectorAction.ActionType.PREDICT)
.method("get")
.url("wrong url")
.requestBody("{\"input\": \"${parameters.input}\"}")
.build();
Connector connector = HttpConnector.builder().name("test connector").version("1").protocol("http").actions(Arrays.asList(predictAction)).build();
HttpJsonConnectorExecutor executor = new HttpJsonConnectorExecutor(connector);
executor.invokeRemoteModel(null, null, null, null);
}

@Test
public void invokeRemoteModel_WrongHttpMethod() {
exceptionRule.expect(IllegalArgumentException.class);
Expand Down

0 comments on commit 4de4d40

Please sign in to comment.