@Test public void testAddType() { e.addType(PROPERTY_CHANGED); assertEquals(2, e.getTypes().size()); assertTrue( "Should contain: " + PROPERTY_CHANGED, contains(e.getTypes().iterator(), PROPERTY_CHANGED)); assertTrue("Should contain: 1", contains(e.getTypes().iterator(), 1)); }
@Test public void testGetPathWithProperties() throws Exception { final FedoraEvent e = new FedoraEvent( new TestEvent( PROPERTY_CHANGED, "Path/Child", "UserId", "Identifier", ImmutableMap.of("1", "2"), "data", 0L)); assertEquals("Path", e.getPath()); }
@Test public void testToString() throws RepositoryException { final String text = e.toString(); assertTrue("Should contain path: " + text, text.contains(e.getPath())); assertTrue("Should contain info: " + text, text.contains(e.getInfo().toString())); assertTrue( "Should contain types: " + text, text.contains(Integer.toString(e.getTypes().iterator().next()))); assertTrue("Should contain date: " + text, text.contains(Long.toString(e.getDate()))); assertFalse("Should not contain user-data: " + text, text.contains(e.getUserData())); assertFalse("Should not contain identifier: " + text, text.contains(e.getIdentifier())); assertFalse("Should not contain user-id: " + text, text.contains(e.getUserID())); }
@Test public void testGetUserData() throws Exception { assertEquals("data", e.getUserData()); }
@Test public void testGetInfo() throws Exception { final Map<?, ?> m = e.getInfo(); assertEquals("2", m.get("1")); }
@Test public void testGetIdentifier() throws Exception { assertEquals("Identifier", e.getIdentifier()); }
@Test public void testGetUserID() { assertEquals("UserId", e.getUserID()); }
@Test public void testGetPath() throws Exception { assertEquals("Path/Child", e.getPath()); }
@Test public void testGetType() { assertEquals(singleton(1), e.getTypes()); }
@Test public void testAddProperty() { e.addProperty("prop"); assertEquals(1, e.getProperties().size()); assertEquals("prop", e.getProperties().iterator().next()); }
@Test public void testGetDate() throws Exception { assertEquals(0L, e.getDate()); }