Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Mar 15, 2013
1 parent 09f59dc commit bbcff84
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 0 deletions.
Expand Up @@ -7,6 +7,15 @@ public class FixityResult {

public URI computedChecksum;

public FixityResult() {

}

public FixityResult(long size, URI checksum) {
this.computedSize = size;
this.computedChecksum = checksum;
}

public boolean equals(Object obj) {

boolean result = false;
Expand Down
Expand Up @@ -4,6 +4,7 @@
import static org.junit.Assert.assertEquals;

import java.net.URI;
import java.net.URISyntaxException;

import org.junit.Test;

Expand All @@ -21,4 +22,9 @@ public void testSHA1() {
.create("urn:sha1:fake"), ContentDigest.asURI("SHA1", "fake"));
}

@Test
public void testAsString() throws URISyntaxException {
assertEquals("fictionalsha", ContentDigest.asChecksumString(new URI("urn:sha:fictionalsha")));
}

}
24 changes: 24 additions & 0 deletions fcrepo-kernel/src/test/java/org/fcrepo/utils/EventTypeTest.java
@@ -0,0 +1,24 @@
package org.fcrepo.utils;

import org.junit.Test;

import javax.jcr.observation.Event;

import static org.junit.Assert.assertEquals;

public class EventTypeTest {
@Test
public void testGetEventType() throws Exception {
// assertEquals(javax.jcr.observation.Event.NODE_ADDED, EventType.getEventType(0x1));
}

@Test
public void testGetEventName() throws Exception {
assertEquals("node added", EventType.getEventName(Event.NODE_ADDED));
assertEquals("node removed", EventType.getEventName(Event.NODE_REMOVED));
assertEquals("property added", EventType.getEventName(Event.PROPERTY_ADDED));
assertEquals("property removed", EventType.getEventName(Event.PROPERTY_REMOVED));
assertEquals("node moved", EventType.getEventName(Event.NODE_MOVED));
assertEquals("persist", EventType.getEventName(Event.PERSIST));
}
}
22 changes: 22 additions & 0 deletions fcrepo-kernel/src/test/java/org/fcrepo/utils/FixityResultTest.java
@@ -0,0 +1,22 @@
package org.fcrepo.utils;

import org.junit.Test;

import java.net.URI;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

public class FixityResultTest {
@Test
public void testEquals() throws Exception {

assertEquals(new FixityResult(100L, new URI("urn:123")), new FixityResult(100L, new URI("urn:123")));

assertNotEquals(new FixityResult(99L, new URI("urn:123")), new FixityResult(100L, new URI("urn:123")));

assertNotEquals(new FixityResult(100L, new URI("urn:321")), new FixityResult(100L, new URI("urn:123")));

assertNotEquals(new FixityResult(99L, new URI("urn:321")), new FixityResult(100L, new URI("urn:123")));
}
}

0 comments on commit bbcff84

Please sign in to comment.