Search in sources :

Example 1 with DeveloperDto

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;
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer) DeveloperDto(com.viadee.sonarQuest.dtos.DeveloperDto)

Example 2 with 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());
}
Also used : Developer(com.viadee.sonarQuest.entities.Developer) DeveloperDto(com.viadee.sonarQuest.dtos.DeveloperDto) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Aggregations

DeveloperDto (com.viadee.sonarQuest.dtos.DeveloperDto)2 Developer (com.viadee.sonarQuest.entities.Developer)2 Test (org.junit.Test)1 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)1