Esempio n. 1
0
  @Test
  public void testEqualsObject() {
    Log.info(Log.FAC_TEST, "Starting testEqualsObject");

    Collection cd = new Collection();
    Collection cd2 = new Collection();
    Collection cd3 = new Collection();

    for (int i = 0; i < lrs.length; ++i) {
      cd.add(lrs[i]);
      cd2.add(lrs[i]);
      cd3.add(lrs[lrs.length - i - 1]);
    }
    Assert.assertEquals(cd, cd2);
    Assert.assertFalse(cd.equals(cd3));
    cd.remove(2);
    Collection cd4 = cd2.clone();
    Assert.assertFalse(cd.equals(cd2));
    Assert.assertEquals(cd4, cd2);
    cd2.remove(2);
    Assert.assertEquals(cd, cd2);

    cd2.remove(2); // remove last entry
    cd2.add(new Link(name3, las[2]));
    cd2.add(new Link(name4, las[3]));
    Assert.assertEquals(cd2, cd4);

    Log.info(Log.FAC_TEST, "Completed testEqualsObject");
  }
Esempio n. 2
0
  @Test
  public void testRemoveLink() {
    Log.info(Log.FAC_TEST, "Starting testRemoveLink");

    Collection cd = new Collection();
    for (int i = 0; i < lrs.length; ++i) {
      cd.add(lrs[i]);
    }
    cd.remove(lrs[0]);
    Assert.assertEquals(cd.get(0), lrs[1]);
    LinkAuthenticator la2alt =
        new LinkAuthenticator(pubID2, null, null, SignedInfo.ContentType.DATA, contenthash1);

    Link lr2alt = new Link(name3, la2alt);
    cd.remove(lr2alt);
    Assert.assertEquals(cd.get(1), lrs[3]);

    Log.info(Log.FAC_TEST, "Completed testRemoveLink");
  }
Esempio n. 3
0
  @Test
  public void testValidate() {
    Log.info(Log.FAC_TEST, "Starting testValidate");

    Collection cd = new Collection();
    Assert.assertTrue(cd.validate());
    cd.add(lrs[0]);
    Assert.assertTrue(cd.validate());
    cd.remove(0);
    Assert.assertTrue(cd.validate());

    Log.info(Log.FAC_TEST, "Completed testValidate");
  }
Esempio n. 4
0
  @Test
  public void testRemoveInt() {
    Log.info(Log.FAC_TEST, "Starting testRemoveInt");

    Collection cd = new Collection();
    for (int i = 0; i < lrs.length; ++i) {
      cd.add(lrs[i]);
    }
    cd.remove(0);
    Assert.assertEquals(cd.get(0), lrs[1]);

    Log.info(Log.FAC_TEST, "Completed testRemoveInt");
  }