TenantHandler extends HttpHandler { @Override protected HttpResponse handlePUT(HttpRequest request) { TenantName tenantName = getAndValidateTenantFromRequest(request); try { tenantRepository.addTenant(tenantName); } catch (Exception e) { throw new InternalServerException(Exceptions.toMessageString(e)); } return new TenantCreateResponse(tenantName); } @Inject  TenantHandler(Context ctx, ApplicationRepository applicationRepository);   }
@Test(expected=BadRequestException.class) public void testCreateExisting() throws Exception { assertNull(tenantRepository.getTenant(a)); TenantCreateResponse response = putSync(HttpRequest.createTestRequest( "http: assertResponseEquals(response, "{\"message\":\"Tenant a created.\"}"); assertEquals(tenantRepository.getTenant(a).getName(), a); handler.handlePUT(HttpRequest.createTestRequest("http: }