Package lpa.model

Examples of lpa.model.Edge


    /**
     * Test of execute method, of class EdgeCommand.
     */
    public void testExecute() {
        System.out.println("execute");
        Edge e = new Edge(0, 0, EdgeState.MAYBE);
        EdgeCommand instance = new EdgeCommand(e, EdgeState.NO);
        try {
            instance.execute();
        } catch (IllegalStateException ex) {
            fail("Command already executed.");
        }
       
        assertEquals("Invalid edge state after command execution", e.getState(), EdgeState.NO);
    }
View Full Code Here


    /**
     * Test of undo method, of class EdgeCommand.
     */
    public void testUndo() {
        System.out.println("undo");
        Edge e = new Edge(0, 0, EdgeState.MAYBE);
        EdgeCommand instance = new EdgeCommand(e, EdgeState.NO);
        instance.execute();
        try {
            instance.undo();
        } catch (IllegalStateException ex) {
            fail("Command wasn't executed, cannot be undone.");
        }
       
        assertEquals("Invalid edge state after command execution", e.getState(), EdgeState.MAYBE);
    }
View Full Code Here

     * Test of execute method, of class CompoundCommand.
     */
    public void testExecute() {
        System.out.println("execute");
        try {
            Edge e = new Edge(0, 0, EdgeState.MAYBE);
            Command c = new EdgeCommand(e);
            CompoundCommand instance = new CompoundCommand();
            instance.add(c);
            instance.execute();

            assertEquals("Command not executed.", c.executed, true);
            assertEquals("Invalid receiver state.", e.getState(), EdgeState.YES);
        } catch (Exception ex) {
            fail("Exception raised.");
        }
    }
View Full Code Here

     * Test of undo method, of class CompoundCommand.
     */
    public void testUndo() {
        System.out.println("undo");
        try {
            Edge e = new Edge(0, 0, EdgeState.MAYBE);
            Command c = new EdgeCommand(e);
            CompoundCommand instance = new CompoundCommand();
            instance.add(c);
            instance.execute();
            instance.undo();

            assertEquals("Command not executed.", c.executed, false);
            assertEquals("Invalid receiver state.", e.getState(), EdgeState.MAYBE);
        } catch (Exception ex) {
            fail("Exception raised.");
        }
    }
View Full Code Here

     * Test of commandCount method, of class CompoundCommand.
     */
    public void testCommandCount() {
        System.out.println("commandCount");
        CompoundCommand instance = new CompoundCommand();
        instance.add(new EdgeCommand(new Edge(0, 0, EdgeState.MAYBE)));
        int expResult = 1;
        int result = instance.commandCount();
        assertEquals(expResult, result);
    }
View Full Code Here

TOP

Related Classes of lpa.model.Edge

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.