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.Difference; 11 import com.hp.hpl.jena.graph.test.*; 12 13 import junit.framework.*; 14 15 18 public class TestDifference extends GraphTestBase 19 { 20 public TestDifference( String name ) 21 { super( name ); } 22 23 public static TestSuite suite() 24 { return new TestSuite( TestDifference.class ); } 25 26 public void testDifference() 27 { 28 Graph g1 = graphWith( "x R y; p R q" ); 29 Graph g2 = graphWith( "r A s; x R y" ); 30 Difference d = new Difference( g1, g2 ); 31 assertOmits( "Difference", d, "x R y" ); 32 assertContains( "Difference", "p R q", d ); 33 assertOmits( "Difference", d, "r A s" ); 34 if (d.size() != 1) 35 fail( "oops: size of difference is not 1" ); 36 d.add( triple( "cats eat cheese" ) ); 37 assertContains( "Difference.L", "cats eat cheese", g1 ); 38 assertOmits( "Difference.R", g2, "cats eat cheese" ); 39 } 40 } 41 42 71 | Popular Tags |