### Question:
SecurityServersApiController implements SecurityServersApi { @Override @PreAuthorize("hasAuthority('INIT_CONFIG')") public ResponseEntity<SecurityServer> getSecurityServer(String encodedSecurityServerId) { SecurityServerId securityServerId = securityServerConverter.convertId(encodedSecurityServerId); if (!globalConfService.securityServerExists(securityServerId)) { throw new ResourceNotFoundException("Security server " + encodedSecurityServerId + " not found"); } SecurityServer securityServer = securityServerConverter.convert(securityServerId); return new ResponseEntity<>(securityServer, HttpStatus.OK); } @Autowired  SecurityServersApiController(GlobalConfService globalConfService,
            SecurityServerConverter securityServerConverter); @Override @PreAuthorize("hasAuthority('INIT_CONFIG')") ResponseEntity<SecurityServer> getSecurityServer(String encodedSecurityServerId);  }### Answer:
@Test @WithMockUser(authorities = { "INIT_CONFIG" }) public void getSecurityServerFindsOne() { ResponseEntity<SecurityServer> response = securityServersApiController.getSecurityServer( "XRD2:GOV:M4:server1"); assertEquals(HttpStatus.OK, response.getStatusCode()); SecurityServer securityServer = response.getBody(); assertEquals("XRD2:GOV:M4:server1", securityServer.getId()); assertEquals("XRD2", securityServer.getInstanceId()); assertEquals("GOV", securityServer.getMemberClass()); assertEquals("M4", securityServer.getMemberCode()); assertEquals("server1", securityServer.getServerCode()); }
@Test(expected = ResourceNotFoundException.class) @WithMockUser(authorities = { "INIT_CONFIG" }) public void getSecurityServerNoMatch() { securityServersApiController.getSecurityServer("XRD2:GOV:M4:server-does-not-exist"); }
@Test(expected = BadRequestException.class) @WithMockUser(authorities = { "INIT_CONFIG" }) public void getSecurityServerBadRequest() { securityServersApiController.getSecurityServer("XRD2:GOV:M4:server:somethingExtra"); }