src/test/java/com/ve/cxe/commons/collection/CyclicFixedPumpTest.java
/**
     * Test of Add and Remove method
     */
Test of Add and Remove method
Test of Add and Remove method
@Test
    public void testCyclicAdd() {
        System.out.println("#### CyclicFixedPump Test_Cyclic_Add");
        int count = 2;
        CyclicFixedPump fastFixedPump = new CyclicFixedPump(count, 1);
        fastFixedPump.add("V");
        fastFixedPump.add("S");
        fastFixedPump.add("X");
        assertTrue(fastFixedPump.size() == count); 
        Object[] pumped1 = new Object[1];
        fastFixedPump.pump(pumped1);
        assertTrue(pumped1[0] == "X");
        Object[] pumped2 = new Object[1];
        fastFixedPump.pump(pumped2);
        assertTrue(pumped2[0] == "S");
        System.out.println("LastDrop: " + Arrays.toString(fastFixedPump.lastDrop()));
        System.out.println("To Array: " + Arrays.toString(fastFixedPump.toArray()));
        System.out.println("Pump Again: " + Arrays.toString(fastFixedPump.pump()));
        System.out.println("LastDrop Again: " + Arrays.toString(fastFixedPump.lastDrop()));
        System.out.println("To Array Again: " + Arrays.toString(fastFixedPump.toArray()));
    }
@ Test public void testCyclicAdd ( ) { System . out . println ( "#### CyclicFixedPump Test_Cyclic_Add" ) ; int count = 2 ; CyclicFixedPump fastFixedPump = new CyclicFixedPump ( count , 1 ) ; fastFixedPump . add ( "V" ) ; fastFixedPump . add ( "S" ) ; fastFixedPump . add ( "X" ) ; assertTrue ( fastFixedPump . size ( ) == count ) ; Object [ ] pumped1 = new Object [ 1 ] ; fastFixedPump . pump ( pumped1 ) ; assertTrue ( pumped1 [ 0 ] == "X" ) ; Object [ ] pumped2 = new Object [ 1 ] ; fastFixedPump . pump ( pumped2 ) ; assertTrue ( pumped2 [ 0 ] == "S" ) ; System . out . println ( "LastDrop: " + Arrays . toString ( fastFixedPump . lastDrop ( ) ) ) ; System . out . println ( "To Array: " + Arrays . toString ( fastFixedPump . toArray ( ) ) ) ; System . out . println ( "Pump Again: " + Arrays . toString ( fastFixedPump . pump ( ) ) ) ; System . out . println ( "LastDrop Again: " + Arrays . toString ( fastFixedPump . lastDrop ( ) ) ) ; System . out . println ( "To Array Again: " + Arrays . toString ( fastFixedPump . toArray ( ) ) ) ; }
Test of Add and Remove method
Test of Add and Remove method
//Now theretically Evicts V and has X instead // Regardless of the fact that we added 3 items; //Top was X