consensus-bizur/src/test/java/com/mboysan/consensus/BizurNodeTest.java
/**
     * Tests set/get operations when everything is running smoothly.
     */
Tests set/get operations when everything is running smoothly.
Tests set / get operations when everything is running smoothly .
@Test
    void testWhenAllConnectedThenSetAndGetSucceeds() throws Exception {
        init(3);
        int leaderId = assertOneLeader();
        Map<String, String> expectedKVs = new HashMap<>() {{
            put("k0", "v0");
            put("k1", "v1");
            put("k2", "v2");
        }};
        for (String expKey : expectedKVs.keySet()) {
            String expVal = expectedKVs.get(expKey);
            getNode(leaderId).set(expKey, expVal).get();
            assertEquals(expVal, getNode(leaderId).get(expKey).get());
        }
        assertLeaderNotChanged(leaderId);
        assertBucketMapsEquals(expectedKVs);
        advanceTimeForElections();  
        assertLeaderNotChanged(leaderId);
        assertBucketMapsEquals(expectedKVs);
    }
@ Test void testWhenAllConnectedThenSetAndGetSucceeds ( ) throws Exception { init ( 3 ) ; int leaderId = assertOneLeader ( ) ; Map < String , String > expectedKVs = new HashMap < > ( ) { { put ( "k0" , "v0" ) ; put ( "k1" , "v1" ) ; put ( "k2" , "v2" ) ; } } ; for ( String expKey : expectedKVs . keySet ( ) ) { String expVal = expectedKVs . get ( expKey ) ; getNode ( leaderId ) . set ( expKey , expVal ) . get ( ) ; assertEquals ( expVal , getNode ( leaderId ) . get ( expKey ) . get ( ) ) ; } assertLeaderNotChanged ( leaderId ) ; assertBucketMapsEquals ( expectedKVs ) ; advanceTimeForElections ( ) ; assertLeaderNotChanged ( leaderId ) ; assertBucketMapsEquals ( expectedKVs ) ; }
Tests set/get operations when everything is running smoothly.
Tests set / get operations when everything is running smoothly .
// everything should stay the same even after some time passes