Skip to content

Commit

Permalink
Added simple test for ContentDigest helper class
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Mar 7, 2013
1 parent b4afade commit 0b7fafd
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
12 changes: 5 additions & 7 deletions fcrepo-kernel/src/main/java/org/fcrepo/utils/ContentDigest.java
@@ -1,18 +1,16 @@

package org.fcrepo.utils;

import java.net.URI;
import java.net.URISyntaxException;
import java.util.HashMap;
import java.util.Map;

import com.google.common.collect.ImmutableMap;

public class ContentDigest {
public final static Map<String, String> algorithmToScheme;

static
{
algorithmToScheme = new HashMap<String, String>();
algorithmToScheme.put("SHA-1", "urn:sha1");
}
public final static Map<String, String> algorithmToScheme = ImmutableMap
.of("SHA-1", "urn:sha1");

public static URI asURI(String algorithm, String value) {
try {
Expand Down
@@ -0,0 +1,18 @@

package org.fcrepo.utils;

import static org.junit.Assert.assertEquals;

import java.net.URI;

import org.junit.Test;

public class ContentDigestTest {

@Test
public void testSHA_1() {
assertEquals("Failed to produce a proper content digest URI!", URI
.create("urn:sha1:fake"), ContentDigest.asURI("SHA-1", "fake"));
}

}

0 comments on commit 0b7fafd

Please sign in to comment.