public void testMediaTypeSingleton() { final IGraphInfo info = new DefaultGraphInfo(_DEFAULT_URI, MediaType.XTM); assertEquals(_DEFAULT_URI, info.getURI()); assertEquals(-1, info.getLastModification()); assertEquals(1, info.getSupportedMediaTypes().size()); assertEquals(MediaType.XTM, info.getSupportedMediaTypes().get(0)); assertNull(info.getTitle()); assertNull(info.getDescription()); }
public void testMediaTypeSingletonTitleAndDescription() { final String title = "Graph"; final String descr = "Hi I'm a graph"; final IGraphInfo info = new DefaultGraphInfo(_DEFAULT_URI, MediaType.XTM, -1, title, descr); assertEquals(_DEFAULT_URI, info.getURI()); assertEquals(-1, info.getLastModification()); assertEquals(1, info.getSupportedMediaTypes().size()); assertEquals(MediaType.XTM, info.getSupportedMediaTypes().get(0)); assertEquals(title, info.getTitle()); assertEquals(descr, info.getDescription()); }
public void testEquals() { final IGraphInfo info1 = new DefaultGraphInfo(_DEFAULT_URI, MediaType.CTM); IGraphInfo info2 = new DefaultGraphInfo(_DEFAULT_URI, MediaType.CTM); assertEquals(info1, info1); assertEquals(info1, info2); assertEquals(info2, info1); assertEquals(info1.hashCode(), info2.hashCode()); info2 = new DefaultGraphInfo(_DEFAULT_URI, MediaType.RDF_XML); assertFalse(info1.equals(info2)); assertFalse(info1.hashCode() == info2.hashCode()); }
public void testDate() { final long date = new Date().getTime(); final IGraphInfo info = new DefaultGraphInfo(_DEFAULT_URI, MediaType.XTM, date); assertEquals(_DEFAULT_URI, info.getURI()); assertEquals(date, info.getLastModification()); assertEquals(1, info.getSupportedMediaTypes().size()); assertNull(info.getTitle()); assertNull(info.getDescription()); }
public void testMediaTypeList() { final List<MediaType> mediaTypes = new ArrayList<MediaType>(); mediaTypes.add(MediaType.XTM); mediaTypes.add(MediaType.RDF_XML); final IGraphInfo info = new DefaultGraphInfo(_DEFAULT_URI, mediaTypes); assertEquals(_DEFAULT_URI, info.getURI()); assertEquals(-1, info.getLastModification()); assertEquals(2, info.getSupportedMediaTypes().size()); assertTrue(info.getSupportedMediaTypes().contains(MediaType.XTM)); assertTrue(info.getSupportedMediaTypes().contains(MediaType.RDF_XML)); assertNull(info.getTitle()); assertNull(info.getDescription()); }
public void testNotEquals() { final IGraphInfo info1 = new DefaultGraphInfo(_DEFAULT_URI, MediaType.CTM); final IGraphInfo info2 = new DefaultFragmentInfo( _DEFAULT_URI, new DefaultResource(URI.create("http://www.example.org/resource")), MediaType.CTM); assertFalse(info1.equals(info2)); assertFalse(info2.equals(info1)); assertFalse(info1.hashCode() == info2.hashCode()); }
public void testMediaTypeListTitleAndDescription() { final String title = "Graph"; final String descr = "Hi I'm a graph"; final List<MediaType> mediaTypes = new ArrayList<MediaType>(); mediaTypes.add(MediaType.XTM); mediaTypes.add(MediaType.RDF_XML); final IGraphInfo info = new DefaultGraphInfo(_DEFAULT_URI, mediaTypes, -1, title, descr); assertEquals(_DEFAULT_URI, info.getURI()); assertEquals(-1, info.getLastModification()); assertEquals(2, info.getSupportedMediaTypes().size()); assertTrue(info.getSupportedMediaTypes().contains(MediaType.XTM)); assertTrue(info.getSupportedMediaTypes().contains(MediaType.RDF_XML)); assertEquals(title, info.getTitle()); assertEquals(descr, info.getDescription()); }