Example #1
0
  private void testProjectSearch(
      User user, Project project, String accept, Condition<String> condition) {
    // Given
    String query = project.name;

    // When
    Result result =
        callAction(
            routes.ref.ProjectApp.projects(query, 1),
            fakeRequest()
                .withHeader(Http.HeaderNames.ACCEPT, accept)
                .withSession(UserApp.SESSION_USERID, user.id.toString()));

    // Then
    assertThat(status(result)).isEqualTo(OK);
    assertThat(contentType(result)).isEqualTo(accept);
    assertThat(contentAsString(result)).is(condition);
  }
Example #2
0
 @Test
 public void projectSearchWithNoAcceptHeader() {
   Result result = callAction(routes.ref.ProjectApp.projects("", 1), fakeRequest());
   assertThat(status(result)).isEqualTo(NOT_ACCEPTABLE);
 }