Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
46822943: Unit test frepo-http-api/FedoraIdentifiers
Unit test for FedoraIdentifiers https://www.pivotaltracker.com/story/show/46822943
- Loading branch information
Edwin Shin
committed
Apr 1, 2013
1 parent
28016ae
commit df8b211
Showing
1 changed file
with
44 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
fcrepo-http-api/src/test/java/org/fcrepo/api/FedoraIdentifiersTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package org.fcrepo.api; | ||
|
||
import static org.junit.Assert.assertNotNull; | ||
import static org.mockito.Mockito.when; | ||
|
||
import org.fcrepo.identifiers.PidMinter; | ||
import org.fcrepo.jaxb.responses.management.NextPid; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.mockito.InjectMocks; | ||
import org.mockito.Mock; | ||
import org.mockito.MockitoAnnotations; | ||
|
||
import com.google.common.base.Function; | ||
|
||
public class FedoraIdentifiersTest { | ||
|
||
@Mock | ||
private PidMinter mockPidMinter; | ||
|
||
@InjectMocks | ||
private FedoraIdentifiers fi = new FedoraIdentifiers(); | ||
|
||
@Before | ||
public void initMocks() { | ||
MockitoAnnotations.initMocks(this); | ||
} | ||
|
||
@Test | ||
public void testGetNextPid() { | ||
when(mockPidMinter.makePid()).thenReturn(new Function<Object, String>() { | ||
|
||
@Override | ||
public String apply(Object input) { | ||
return "asdf:123"; | ||
} | ||
}); | ||
|
||
NextPid np = fi.getNextPid(2); | ||
|
||
//TODO: test for actual values | ||
assertNotNull(np); | ||
} | ||
} |