forked from hypergraphdb/hypergraphdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
80-HGStorageImplementation-interface-test: progress on refactoring ex…
…isting test cases
- Loading branch information
Showing
9 changed files
with
163 additions
and
223 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
storage/bdb-je/test/java/hgtest/storage/bje/BJETxLock/BJETxLockTestBasis.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,32 @@ | ||
package hgtest.storage.bje.BJETxLock; | ||
|
||
import static org.junit.rules.ExpectedException.none; | ||
|
||
import org.easymock.EasyMock; | ||
import org.hypergraphdb.HyperGraph; | ||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.rules.ExpectedException; | ||
|
||
public class BJETxLockTestBasis | ||
{ | ||
protected final HyperGraph mockedGraph = EasyMock | ||
.createStrictMock(HyperGraph.class); | ||
|
||
@Rule | ||
public final ExpectedException below = none(); | ||
|
||
@Before | ||
public void resetAndReplayMock() throws Exception | ||
{ | ||
EasyMock.reset(mockedGraph); | ||
EasyMock.replay(mockedGraph); | ||
} | ||
|
||
@After | ||
public void verifyMock() throws Exception | ||
{ | ||
EasyMock.verify(mockedGraph); | ||
} | ||
} |
62 changes: 0 additions & 62 deletions
62
storage/bdb-je/test/java/hgtest/storage/bje/BJETxLock/BJETxLock_constructor2Test.java
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
storage/bdb-je/test/java/hgtest/storage/bje/BJETxLock/BJETxLock_constructorTest.java
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
...-je/test/java/hgtest/storage/bje/BJETxLock/BJETxLock_constructorWithArrayOfBytesTest.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,33 @@ | ||
package hgtest.storage.bje.BJETxLock; | ||
|
||
import org.hypergraphdb.storage.bje.BJETxLock; | ||
import org.junit.Test; | ||
|
||
public class BJETxLock_constructorWithArrayOfBytesTest extends | ||
BJETxLockTestBasis | ||
{ | ||
@Test | ||
public void doesNotFail_whenGraphIsNull() throws Exception | ||
{ | ||
final byte[] objectId = new byte[] { 0, 0, 0, 1 }; | ||
|
||
new BJETxLock(null, objectId); | ||
} | ||
|
||
@Test | ||
public void throwsException_whenObjectIdIsNull() throws Exception | ||
{ | ||
final byte[] objectId = null; | ||
|
||
below.expect(NullPointerException.class); | ||
new BJETxLock(mockedGraph, objectId); | ||
} | ||
|
||
@Test | ||
public void happyPath() throws Exception | ||
{ | ||
final byte[] objectId = new byte[] { 0, 0, 0, 1 }; | ||
|
||
new BJETxLock(mockedGraph, objectId); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
...je/test/java/hgtest/storage/bje/BJETxLock/BJETxLock_constructorWithDatabaseEntryTest.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,37 @@ | ||
package hgtest.storage.bje.BJETxLock; | ||
|
||
import org.hypergraphdb.storage.bje.BJETxLock; | ||
import org.junit.Test; | ||
|
||
import com.sleepycat.je.DatabaseEntry; | ||
|
||
public class BJETxLock_constructorWithDatabaseEntryTest extends | ||
BJETxLockTestBasis | ||
{ | ||
@Test | ||
public void doesNotFail_whenGraphIsNull() throws Exception | ||
{ | ||
final DatabaseEntry objectId = new DatabaseEntry(new byte[] { 0, 0, 0, | ||
1 }); | ||
|
||
new BJETxLock(null, objectId); | ||
} | ||
|
||
@Test | ||
public void throwsException_whenObjectIdIsNull() throws Exception | ||
{ | ||
final DatabaseEntry objectId = null; | ||
|
||
below.expect(NullPointerException.class); | ||
new BJETxLock(mockedGraph, objectId); | ||
} | ||
|
||
@Test | ||
public void happyPath() throws Exception | ||
{ | ||
final DatabaseEntry objectId = new DatabaseEntry(new byte[] { 0, 0, 0, | ||
1 }); | ||
|
||
new BJETxLock(mockedGraph, objectId); | ||
} | ||
} |
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
Oops, something went wrong.