### Question:
StatusResource { @GET @Path("/{type}/{entity}/{action}") public Response getStatus( @PathParam("type") String type, @PathParam("entity") String entity, @PathParam("action") String action ) throws Exception { CommandId commandId = new CommandId(type, entity, action); Optional<CommandStatus> commandStatus = statementExecutor.getStatus(commandId); if (!commandStatus.isPresent()) { return Errors.notFound("Command not found"); } return Response.ok(commandStatus.get()).build(); } StatusResource(StatementExecutor statementExecutor); @GET Response getAllStatuses(); @GET @Path("/{type}/{entity}/{action}") Response getStatus(
      @PathParam("type") String type,
      @PathParam("entity") String entity,
      @PathParam("action") String action
  );  }### Answer:
@Test public void testGetStatus() throws Exception { StatusResource testResource = getTestStatusResource(); for (Map.Entry<CommandId, CommandStatus> commandEntry : mockCommandStatuses.entrySet()) { CommandId commandId = commandEntry.getKey(); CommandStatus expectedCommandStatus = commandEntry.getValue(); Object statusEntity = testResource.getStatus(commandId.getType().name(), commandId.getEntity(), commandId.getAction().name()).getEntity(); assertThat(statusEntity, instanceOf(CommandStatus.class)); CommandStatus testCommandStatus = (CommandStatus) statusEntity; assertEquals(expectedCommandStatus, testCommandStatus); } }
@Test public void testGetStatusNotFound() throws Exception { StatusResource testResource = getTestStatusResource(); Response response = testResource.getStatus( CommandId.Type.STREAM.name(), "foo", CommandId.Action.CREATE.name()); assertThat(response.getStatus(), equalTo(Response.Status.NOT_FOUND.getStatusCode())); assertThat(response.getEntity(), instanceOf(KsqlErrorMessage.class)); KsqlErrorMessage errorMessage = (KsqlErrorMessage)response.getEntity(); assertThat(errorMessage.getErrorCode(), equalTo(Errors.ERROR_CODE_NOT_FOUND)); assertThat(errorMessage.getMessage(), equalTo("Command not found")); }