use of org.broadinstitute.consent.http.models.DacBuilder in project consent by DataBiosphere.
the class DacResourceTest method testFindById_success.
@Test
public void testFindById_success() {
Dac dac = new DacBuilder().setDacId(1).setName("name").setDescription("description").build();
when(dacService.findById(1)).thenReturn(dac);
Response response = dacResource.findById(dac.getDacId());
assertEquals(200, response.getStatus());
}
use of org.broadinstitute.consent.http.models.DacBuilder in project consent by DataBiosphere.
the class DacResourceTest method testUpdateDac_badRequest_2.
@Test(expected = BadRequestException.class)
public void testUpdateDac_badRequest_2() {
Dac dac = new DacBuilder().setDacId(null).setName("name").setDescription("description").build();
dacResource.updateDac(authUser, gson.toJson(dac));
}
use of org.broadinstitute.consent.http.models.DacBuilder in project consent by DataBiosphere.
the class DacResourceTest method testCreateDac_badRequest_2.
@Test(expected = BadRequestException.class)
public void testCreateDac_badRequest_2() throws Exception {
Dac dac = new DacBuilder().setName(null).setDescription("description").build();
when(dacService.createDac(any(), any())).thenReturn(1);
when(dacService.findById(1)).thenReturn(dac);
dacResource.createDac(authUser, gson.toJson(dac));
}
use of org.broadinstitute.consent.http.models.DacBuilder in project consent by DataBiosphere.
the class DacResourceTest method testUpdateDac_badRequest_3.
@Test(expected = BadRequestException.class)
public void testUpdateDac_badRequest_3() {
Dac dac = new DacBuilder().setDacId(1).setName(null).setDescription("description").build();
dacResource.updateDac(authUser, gson.toJson(dac));
}
use of org.broadinstitute.consent.http.models.DacBuilder in project consent by DataBiosphere.
the class DacResourceTest method testUpdateDac_success.
@Test
public void testUpdateDac_success() {
Dac dac = new DacBuilder().setDacId(1).setName("name").setDescription("description").build();
doNothing().when(dacService).updateDac(isA(String.class), isA(String.class), isA(Integer.class));
when(dacService.findById(1)).thenReturn(dac);
Response response = dacResource.updateDac(authUser, gson.toJson(dac));
assertEquals(200, response.getStatus());
}
Aggregations