use of com.viadee.sonarQuest.dtos.DeveloperDto in project sonarQuest by viadee.
the class DeveloperController method getDeveloperByID.
/**
* Get a Developer by Id
*
* @param id
* @return
*/
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public DeveloperDto getDeveloperByID(@PathVariable(value = "id") Long id) {
Developer developer = this.developerRepository.findById(id);
DeveloperDto developerDto = null;
if (developer != null) {
developerDto = this.toDeveloperDto(developer);
}
return developerDto;
}
use of com.viadee.sonarQuest.dtos.DeveloperDto in project sonarQuest by viadee.
the class UserManagementIT method testCreateDeleteDeveloper.
@Test
public void testCreateDeleteDeveloper() {
// Given
DeveloperDto developerDto = new DeveloperDto("testusername");
final long count = developerRepository.count();
// When
developerService.createDeveloper(developerDto);
// Then
Developer dev = developerRepository.findByUsername("testusername");
assertNotNull("developer could not be created", dev);
assertEquals("number of devs is inconsistent", developerRepository.count(), count + 1);
assertFalse(dev.isDeleted());
// When
developerService.deleteDeveloper(dev);
assertTrue("developer was not deleted", developerRepository.findByUsername("testusername").isDeleted());
// since deleting is logical deleting and not physical
assertEquals("number of devs is inconsistent", developerRepository.count(), count + 1);
assertTrue(dev.isDeleted());
}
Aggregations