@Test
 public void shouldSearchAConceptSourceIfItMatchesTheQuery() throws Exception {
   MockHttpServletRequest req = request(RequestMethod.GET, getURI());
   req.addParameter("q", "ome");
   SimpleObject result = deserialize(handle(req));
   Assert.assertEquals(2, Util.getResultsSize(result));
 }
  @Test
  public void shouldGetAll() throws Exception {
    SimpleObject result = deserialize(handle(request(RequestMethod.GET, getURI())));

    Assert.assertNotNull(result);
    Assert.assertEquals(getAllCount(), Util.getResultsSize(result));
  }
  @Test
  public void shouldListAllConceptSources() throws Exception {
    MockHttpServletRequest req = request(RequestMethod.GET, getURI());
    SimpleObject result = deserialize(handle(req));

    Assert.assertNotNull(result);
    Assert.assertEquals(getAllCount(), Util.getResultsSize(result));
  }
 /**
  * @see VisitAttributeTypeController#search(String, javax.servlet.http.HttpServletRequest,
  *     HttpServletResponse)
  */
 @Test
 public void search_shouldFindAllMatchingVisitAttributeTypesIfIncludeAllIsSetToTrue()
     throws Exception {
   MockHttpServletRequest request = emptyRequest();
   request.addParameter(RestConstants.REQUEST_PROPERTY_FOR_INCLUDE_ALL, "true");
   Assert.assertEquals(
       3, Util.getResultsSize(controller.search("date", request, emptyResponse())));
 }
コード例 #5
0
  @Test
  public void shouldListAllUsers() throws Exception {
    int totalCount = Context.getUserService().getAllUsers().size();

    SimpleObject result =
        new UserController().getAll(emptyRequest(), new MockHttpServletResponse());
    Assert.assertNotNull(result);
    Assert.assertEquals(totalCount, Util.getResultsSize(result));
  }
 /**
  * @see VisitAttributeTypeController#search(String, javax.servlet.http.HttpServletRequest,
  *     HttpServletResponse)
  */
 @Test
 public void search_shouldFindMatchingVisitAttributeTypesExcludingRetiredOnes() throws Exception {
   Assert.assertEquals(
       2, Util.getResultsSize(controller.search("date", emptyRequest(), emptyResponse())));
 }
 /**
  * @see VisitAttributeTypeController#getAll(javax.servlet.http.HttpServletRequest,
  *     HttpServletResponse)
  */
 @Test
 public void getAll_shouldGellVisitAttributeTypesExcludingRetiredOnes() throws Exception {
   Assert.assertEquals(3, Util.getResultsSize(controller.getAll(emptyRequest(), emptyResponse())));
 }