@Test
 public void testGetAllResourceServers() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     Collection<ResourceServerDTO> result = resource.getAll();
     assertEquals(1, result.size());
     resource.add(
         ResourceServerDataGenerator.generateResourceServerDTO("rs_another_resource_server"));
     result = resource.getAll();
     assertEquals(2, result.size());
   } finally {
     resource.delete(NAME);
     resource.delete("rs_another_resource_server");
   }
 }
 @Test(expected = InternalServerErrorException.class)
 public void testAddResourceServerAlreadyExists() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
   } finally {
     resource.delete(NAME);
   }
 }
 @Test
 public void testGetResourceServer() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     ResourceServerDTO result = resource.get(NAME);
     assertResourceServer(result);
   } finally {
     resource.delete(NAME);
   }
 }
 @Test
 public void testUpdateResourceServer() throws Exception {
   try {
     resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
     Set<String> groupFilter = new HashSet<String>(Arrays.asList("a", "b"));
     ResourceServerDTO rsToUpdate =
         ResourceServerDTO.builder().withName(NAME).withGroupFilter(groupFilter).build();
     ResourceServerDTO updatedRS = resource.update(NAME, rsToUpdate);
     assertEquals(groupFilter, updatedRS.getGroupFilter());
   } finally {
     resource.delete(NAME);
   }
 }
 public void testDeleteResourceServer() throws Exception {
   resource.add(ResourceServerDataGenerator.generateResourceServerDTO(NAME));
   resource.delete(NAME);
   Collection<ResourceServerDTO> result = resource.getAll();
   assertEquals(0, result.size());
 }