diff options
Diffstat (limited to 'same/src/test/java/com')
-rw-r--r-- | same/src/test/java/com/orbekk/paxos/MasterProposerTest.java | 8 | ||||
-rw-r--r-- | same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java | 18 |
2 files changed, 13 insertions, 13 deletions
diff --git a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java index 45ee53e..dfc0b19 100644 --- a/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java +++ b/same/src/test/java/com/orbekk/paxos/MasterProposerTest.java @@ -30,8 +30,8 @@ public class MasterProposerTest { @Test public void successfulProposal() { connections.paxosMap.put("p1", p1); - when(p1.propose("client1", 1)).thenReturn(true); - when(p1.acceptRequest("client1", 1)).thenReturn(true); + when(p1.propose("client1", 1)).thenReturn(1); + when(p1.acceptRequest("client1", 1)).thenReturn(1); MasterProposer c1 = new MasterProposer( "client1", @@ -42,8 +42,8 @@ public class MasterProposerTest { @Test public void unsucessfulProposal() { connections.paxosMap.put("p1", p1); - when(p1.propose("client1", 1)).thenReturn(true); - when(p1.acceptRequest("client1", 1)).thenReturn(false); + when(p1.propose("client1", 1)).thenReturn(1); + when(p1.acceptRequest("client1", 1)).thenReturn(1); MasterProposer c1 = new MasterProposer( "client1", diff --git a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java index f9ee058..0165d4c 100644 --- a/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java +++ b/same/src/test/java/com/orbekk/paxos/PaxosServiceTest.java @@ -37,23 +37,23 @@ public class PaxosServiceTest { @Test public void simpleCase() { - assertTrue(p1.propose(client, 1)); - assertTrue(p1.acceptRequest(client, 1)); + assertEquals(1, p1.propose(client, 1)); + assertEquals(1, p1.acceptRequest(client, 1)); } @Test public void lowerProposalFails() { - assertTrue(p1.propose(client1, 10)); - assertFalse(p1.propose(client2, 9)); - assertTrue(p1.propose(client2, 100)); + assertEquals(10, p1.propose(client1, 10)); + assertEquals(-10, p1.propose(client2, 9)); + assertEquals(100, p1.propose(client2, 100)); } @Test public void testAccept() { - assertTrue(p1.propose(client1, 3)); - assertTrue(p1.propose(client2, 4)); - assertFalse(p1.acceptRequest(client1, 3)); - assertTrue(p1.acceptRequest(client2, 4)); + assertEquals(3, p1.propose(client1, 3)); + assertEquals(4, p1.propose(client2, 4)); + assertEquals(-4, p1.acceptRequest(client1, 3)); + assertEquals(4, p1.acceptRequest(client2, 4)); } public List<String> paxosUrls() { |