use of com.example.helloworld.core.Person in project dropwizard by dropwizard.
the class IntegrationTest method testRenderingPerson.
@ParameterizedTest
@ValueSource(strings = { "view_freemarker", "view_mustache" })
void testRenderingPerson(String viewName) {
final Person person = new Person("Dr. IntegrationTest", "Chief Wizard", 1525);
final Person newPerson = postPerson(person);
final String url = "http://localhost:" + APP.getLocalPort() + "/people/" + newPerson.getId() + "/" + viewName;
Response response = APP.client().target(url).request().get();
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
use of com.example.helloworld.core.Person in project dropwizard by dropwizard.
the class PersonDAOIntegrationTest method createPerson.
@Test
void createPerson() {
final Person jeff = daoTestRule.inTransaction(() -> personDAO.create(new Person("Jeff", "The plumber", 1995)));
assertThat(jeff.getId()).isPositive();
assertThat(jeff.getFullName()).isEqualTo("Jeff");
assertThat(jeff.getJobTitle()).isEqualTo("The plumber");
assertThat(jeff.getYearBorn()).isEqualTo(1995);
assertThat(personDAO.findById(jeff.getId())).isEqualTo(Optional.of(jeff));
}
use of com.example.helloworld.core.Person in project dropwizard by dropwizard.
the class PeopleResourceTest method createPerson.
@Test
void createPerson() {
when(PERSON_DAO.create(any(Person.class))).thenReturn(person);
final Response response = RESOURCES.target("/people").request(MediaType.APPLICATION_JSON_TYPE).post(Entity.entity(person, MediaType.APPLICATION_JSON_TYPE));
assertThat(response.getStatusInfo()).isEqualTo(Response.Status.OK);
verify(PERSON_DAO).create(personCaptor.capture());
assertThat(personCaptor.getValue()).isEqualTo(person);
}
use of com.example.helloworld.core.Person in project dropwizard by dropwizard.
the class DockerIntegrationTest method testRenderingPerson.
@ParameterizedTest
@ValueSource(strings = { "view_freemarker", "view_mustache" })
void testRenderingPerson(String viewName) {
final Person person = new Person("Dr. IntegrationTest", "Chief Wizard", 1525);
final Person newPerson = postPerson(person);
final String url = "http://localhost:" + APP.getLocalPort() + "/people/" + newPerson.getId() + "/" + viewName;
Response response = APP.client().target(url).request().get();
assertThat(response.getStatus()).isEqualTo(HttpStatus.OK_200);
}
use of com.example.helloworld.core.Person in project dropwizard by dropwizard.
the class IntegrationTest method testPostPerson.
@Test
void testPostPerson() {
final Person person = new Person("Dr. IntegrationTest", "Chief Wizard", 1525);
final Person newPerson = postPerson(person);
assertThat(newPerson.getFullName()).isEqualTo(person.getFullName());
assertThat(newPerson.getJobTitle()).isEqualTo(person.getJobTitle());
}
Aggregations