コード例 #1
0
  /** Tests empty list. */
  @Test
  public void testExecuteEmpty() {
    final List<Long> list = Arrays.asList(1L, 2L, 3L, 4L);

    context.checking(
        new Expectations() {
          {
            oneOf(mapper).execute(SELF_ID);
            will(returnValue(Collections.EMPTY_LIST));
          }
        });

    List<Long> resultList = sut.execute(SELF_ID);

    context.assertIsSatisfied();
    assertTrue(resultList.isEmpty());
  }
コード例 #2
0
  /** Tests list with no self id. */
  @Test
  public void testExecuteNoSelf() {
    final List<Long> list = Arrays.asList(1L, 2L, 3L, 4L);

    context.checking(
        new Expectations() {
          {
            oneOf(mapper).execute(SELF_ID);
            will(returnValue(list));
          }
        });

    List<Long> resultList = sut.execute(SELF_ID);

    context.assertIsSatisfied();
    assertEquals(4, resultList.size());
    for (int i = 0; i < 4; i++) {
      assertEquals((Long) (long) (i + 1), resultList.get(i));
    }
  }