Assistant extends BaseService { public ServiceCall<MessageResponse> message(MessageOptions messageOptions) { com.ibm.cloud.sdk.core.util.Validator.notNull(messageOptions, "messageOptions cannot be null"); String[] pathSegments = {"v2/assistants", "sessions", "message"}; String[] pathParameters = {messageOptions.assistantId(), messageOptions.sessionId()}; RequestBuilder builder = RequestBuilder.post( RequestBuilder.constructHttpUrl(getServiceUrl(), pathSegments, pathParameters)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "message"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); final JsonObject contentJson = new JsonObject(); if (messageOptions.input() != null) { contentJson.add( "input", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions.input())); } if (messageOptions.context() != null) { contentJson.add( "context", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(messageOptions.context())); } builder.bodyJson(contentJson); ResponseConverter<MessageResponse> responseConverter = ResponseConverterUtils.getValue( new com.google.gson.reflect.TypeToken<MessageResponse>() {}.getType()); return createServiceCall(builder.build(), responseConverter); } Assistant(String versionDate);  Assistant(String versionDate, Authenticator authenticator);  Assistant(String versionDate, String serviceName);  Assistant(String versionDate, String serviceName, Authenticator authenticator); ServiceCall<SessionResponse> createSession(CreateSessionOptions createSessionOptions); ServiceCall<Void> deleteSession(DeleteSessionOptions deleteSessionOptions); ServiceCall<MessageResponse> message(MessageOptions messageOptions); ServiceCall<MessageResponseStateless> messageStateless(
      MessageStatelessOptions messageStatelessOptions); ServiceCall<LogCollection> listLogs(ListLogsOptions listLogsOptions); ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions);  }
@Test public void testMessage() throws InterruptedException { server.enqueue(jsonResponse(messageResponse)); MessageOptions messageOptions = new MessageOptions.Builder().assistantId(ASSISTANT_ID).sessionId(SESSION_ID).build(); MessageResponse response = service.message(messageOptions).execute().getResult(); RecordedRequest request = server.takeRequest(); assertEquals(MESSAGE_PATH, request.getPath()); assertNotNull(response.getContext()); assertNotNull(response.getOutput()); assertEquals(DialogNodeAction.Type.CLIENT, response.getOutput().getActions().get(0).getType()); assertEquals(NAME, response.getOutput().getActions().get(0).getName()); assertEquals(MAP, response.getOutput().getActions().get(0).getParameters()); assertEquals(RESULT_VARIABLE, response.getOutput().getActions().get(0).getResultVariable()); assertEquals(CREDENTIALS, response.getOutput().getActions().get(0).getCredentials()); assertEquals( MessageOutputDebug.BranchExitedReason.COMPLETED, response.getOutput().getDebug().getBranchExitedReason()); assertEquals( DialogLogMessage.Level.INFO, response.getOutput().getDebug().getLogMessages().get(0).getLevel()); assertEquals(MESSAGE, response.getOutput().getDebug().getLogMessages().get(0).getMessage()); assertEquals( CONDITIONS, response.getOutput().getDebug().getNodesVisited().get(0).getConditions()); assertEquals(TITLE, response.getOutput().getDebug().getNodesVisited().get(0).getTitle()); assertEquals( DIALOG_NODE, response.getOutput().getDebug().getNodesVisited().get(0).getDialogNode()); assertTrue(response.getOutput().getDebug().isBranchExited()); assertEquals(DESCRIPTION, response.getOutput().getGeneric().get(0).description()); assertEquals( RuntimeResponseGeneric.ResponseType.TEXT, response.getOutput().getGeneric().get(0).responseType()); assertEquals( RuntimeResponseGeneric.Preference.BUTTON, response.getOutput().getGeneric().get(0).preference()); assertEquals(TEXT, response.getOutput().getGeneric().get(0).text()); assertEquals(TIME, response.getOutput().getGeneric().get(0).time()); assertTrue(response.getOutput().getGeneric().get(0).typing()); assertEquals(SOURCE, response.getOutput().getGeneric().get(0).source()); assertEquals(TITLE, response.getOutput().getGeneric().get(0).title()); assertEquals(MESSAGE, response.getOutput().getGeneric().get(0).messageToHumanAgent()); assertEquals(TOPIC, response.getOutput().getGeneric().get(0).topic()); assertEquals(LABEL, response.getOutput().getGeneric().get(0).options().get(0).getLabel()); assertNotNull(response.getOutput().getGeneric().get(0).options().get(0).getValue().getInput()); assertEquals(LABEL, response.getOutput().getGeneric().get(0).suggestions().get(0).getLabel()); assertNotNull(response.getOutput().getGeneric().get(0).suggestions().get(0).getValue()); }