Пример #1
0
  public void testWrapValues2() {
    Collection<Integer> values = ListUtils.listOf(1, 2, 45, 23, 12);
    Collection<DirtyWrapper<Integer>> wrapped = DirtyUtils.wrapValues(values, DirtyState.ADDED);

    assertNotNull(wrapped);
    assertEquals(wrapped.size(), values.size());

    for (DirtyWrapper<Integer> anElem : wrapped) {
      assertTrue(values.contains(anElem.getValue()));
      assertEquals(anElem.getState(), DirtyState.ADDED);
    }
  }
Пример #2
0
  public void testWrap2Null() {
    try {
      DirtyUtils.wrapValues(null, DirtyState.ADDED);
      unexpected("null can't be wrapped.");
    } catch (IllegalArgumentException e) {
      // that's OK
    } catch (Exception e) {
      unexpectedException(e.getMessage());
    }

    try {
      DirtyUtils.wrapValues(ListUtils.listOf(10), null);
      unexpected("state can't be null.");
    } catch (IllegalArgumentException e) {
      // that's OK
    } catch (Exception e) {
      unexpectedException(e.getMessage());
    }
  }