Package org.apache.felix.gogo.shell

Examples of org.apache.felix.gogo.shell.History


    private History history;

    @Before
    public void setup() {
        this.history = new History();
        for (String cmd : COMMANDS) {
            this.history.append(cmd);
        }
    }
View Full Code Here


        }
    }

    @Test
    public void test_add_get_history() {
        final History his = new History();

        his.append("cmd1");
        Iterator<String> hi = his.getHistory();
        TestCase.assertEquals("cmd1", hi.next());
        TestCase.assertFalse(hi.hasNext());
    }
View Full Code Here

        TestCase.assertFalse(hi.hasNext());
    }

    @Test
    public void test_fill_history() {
        final History his = new History();

        // NOTE: Assumes a fixed history size of 100
        for (int i = 0; i < 100; i++) {
            his.append("cmd" + i);
        }

        Iterator<String> hi = his.getHistory();
        for (int i = 0; i < 100; i++) {
            TestCase.assertEquals("cmd" + i, hi.next());
        }
        TestCase.assertFalse(hi.hasNext());
    }
View Full Code Here

        TestCase.assertFalse(hi.hasNext());
    }

    @Test
    public void test_overflow_history() {
        final History his = new History();

        // NOTE: Assumes a fixed history size of 100
        for (int i = -20; i < 100; i++) {
            his.append("cmd" + i);
        }

        Iterator<String> hi = his.getHistory();
        for (int i = 0; i < 100; i++) {
            TestCase.assertEquals("cmd" + i, hi.next());
        }
        TestCase.assertFalse(hi.hasNext());
    }
View Full Code Here

TOP

Related Classes of org.apache.felix.gogo.shell.History

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.