### Question:
CommandController implements BeanClassLoaderAware { @GetMapping("/api") public Map<String, String> getCommandApi() { if (commandApi == null) { initializeCommandApi(); } logger.debug("Getting the list of API commands. Returning all {} known commands.", commandApi.size()); return commandApi; } CommandController(CommandGateway commandGateway,
                             ObjectMapper objectMapper,
                             JsonSchemaGenerator jsonSchemaGenerator); @GetMapping("/api") Map<String, String> getCommandApi(); @PostMapping("/{command-type}") CompletableFuture<ResponseEntity> postCommand(@PathVariable("command-type") String commandType,
                                                         @RequestBody(required = false) String commandPayloadJson); @Override void setBeanClassLoader(@NotNull ClassLoader classLoader);  }### Answer:
@Test public void testGetCommandApiGeneratesAndReturnsApi() throws Exception { int expectedNumberOfCommandApis = 20; Map<String, String> result = testSubject.getCommandApi(); assertEquals(expectedNumberOfCommandApis, result.size()); result.values().forEach(resultCommandSchema -> assertEquals(expectedCommandSchemaString, resultCommandSchema)); verify(jsonSchemaGenerator, times(expectedNumberOfCommandApis)).generateSchema(any(Class.class)); verify(objectMapper, times(expectedNumberOfCommandApis)).writeValueAsString(commandSchema); }