1 6 7 package com.hp.hpl.jena.graph.compose.test; 8 9 import com.hp.hpl.jena.graph.*; 10 import com.hp.hpl.jena.graph.compose.Delta; 11 import com.hp.hpl.jena.graph.test.*; 12 13 import junit.framework.*; 14 15 18 public class TestDelta extends GraphTestBase 19 { 20 21 public TestDelta( String name ) 22 { super( name ); } 23 24 public static TestSuite suite() 25 { return new TestSuite( TestDelta.class ); } 26 27 public void testDelta() 28 { 29 Graph x = graphWith( "x R y" ); 30 assertContains( "x", "x R y", x ); 31 x.delete( triple( "x R y" ) ); 32 assertOmits( "x", x, "x R y" ); 33 34 Graph base = graphWith( "x R y; p S q; I like cheese; pins pop balloons" ); 35 Graph save = graphWith( "x R y; p S q; I like cheese; pins pop balloons" ); 36 Delta delta = new Delta( base ); 37 assertContainsAll( "Delta", delta, "x R y; p S q; I like cheese; pins pop balloons" ); 38 assertContainsAll( "Delta", base, "x R y; p S q; I like cheese; pins pop balloons" ); 39 40 delta.add( triple( "pigs fly winglessly" ) ); 41 delta.delete( triple( "I like cheese" ) ); 42 43 assertContainsAll( "changed Delta", delta, "x R y; p S q; pins pop balloons; pigs fly winglessly" ); 44 assertOmits( "changed delta", delta, "I like cheese" ); 45 assertContains( "delta additions", "pigs fly winglessly", delta.getAdditions() ); 46 assertOmits( "delta additions", delta.getAdditions(), "I like cheese" ); 47 assertContains( "delta deletions", "I like cheese", delta.getDeletions() ); 48 assertOmits( "delta deletions", delta.getDeletions(), "pigs fly winglessly" ); 49 } 50 } 51 52 81 | Popular Tags |