示例#1
0
  @Test
  public void testDelete() throws Exception {
    Resource rhmRes = model.getResource(FakeRDFModel.rhm);

    Model toRemove = ModelFactory.createDefaultModel();
    toRemove.add(model.listStatements(rhmRes, null, (RDFNode) null));
    toRemove.add(model.listStatements(null, null, rhmRes));

    model.remove(toRemove);

    Model foo = changes.get(0).getChange();

    assert changes.size() == 1;
    assert !model.containsResource(rhmRes);

    changes.undo();

    assert changes.size() == 1;
    assert model.containsResource(rhmRes);
    assert model.containsAll(foo);

    changes.redo();

    assert changes.size() == 1;
    assert !model.containsResource(rhmRes);
  }
示例#2
0
  @Test
  public void testCreate() throws Exception {
    Model foo = FakeRDFModel.createInstance("Person", "name", "*****@*****.**");

    model.add(foo);

    assert foo.difference(changes.get(0).getChange()).isEmpty();

    assert changes.size() == 1;
    assert model.containsAll(foo);

    changes.undo();

    assert changes.size() == 1;
    assert !model.containsAny(foo);

    changes.redo();

    assert changes.size() == 1;
    assert model.containsAll(foo);
  }