Пример #1
0
  /**
   * Test method for {@link
   * fhdw.ipscrum.shared.utils.ListUtils#convertObjListToIdList(java.util.List)}.
   */
  @Test
  public final void testConvertObjListToIdList() {
    final Hint hint1 = new Hint(this.getModel(), "Hint 1");
    final Hint hint2 = new Hint(this.getModel(), "Hint 2");
    final Hint hint3 = new Hint(this.getModel(), "Hint 3");
    final Hint hint4 = new Hint(this.getModel(), "Hint 4");

    final List<IdentifiableObject> list = new ArrayList<IdentifiableObject>();
    list.add(hint1);
    list.add(hint2);
    list.add(hint3);
    list.add(hint4);

    final List<String> idList = ListUtils.convertObjListToIdList(list);
    Assert.assertTrue(idList.contains(hint1.getId()));
    Assert.assertTrue(idList.contains(hint2.getId()));
    Assert.assertTrue(idList.contains(hint3.getId()));
    Assert.assertTrue(idList.contains(hint4.getId()));
  }
Пример #2
0
  /**
   * Test method for {@link
   * fhdw.ipscrum.shared.utils.ListUtils#convertIdListToObjList(java.util.List,
   * fhdw.ipscrum.shared.model.Model)} .
   *
   * @throws NoObjectFindException object not found
   */
  @Test
  public final void testConvertIdListToObjList() throws NoObjectFindException {
    final Hint hint1 = new Hint(this.getModel(), "Hint 1");
    final Hint hint2 = new Hint(this.getModel(), "Hint 2");
    final Hint hint3 = new Hint(this.getModel(), "Hint 3");
    final Hint hint4 = new Hint(this.getModel(), "Hint 4");

    final List<String> list = new ArrayList<String>();
    list.add(hint1.getId());
    list.add(hint2.getId());
    list.add(hint3.getId());
    list.add(hint4.getId());

    final List<IdentifiableObject> objectList =
        ListUtils.convertIdListToObjList(list, this.getModel());
    Assert.assertTrue(objectList.contains(hint1));
    Assert.assertTrue(objectList.contains(hint2));
    Assert.assertTrue(objectList.contains(hint3));
    Assert.assertTrue(objectList.contains(hint4));
  }