Package com.lunivore.gameoflife.view.string

Examples of com.lunivore.gameoflife.view.string.StringRenderer


    @Given("a $width by $height game")
    @Aliases(values={"a new game: $width by $height"})
    public void theGameIsRunning(int width, int height) {
        game = new Game(width, height);
        renderer = new StringRenderer();
        game.setObserver(renderer);
    }
View Full Code Here


    private static final String NL = System.getProperty("line.separator");

    @Test
    public void shouldStartEmpty() {
        StringRenderer renderer = new StringRenderer();
        Game game = new Game(6, 4);
        game.setObserver(renderer);
        assertThat(renderer.asString(), Matchers.equalTo(
        "......" + NL +
        "......" + NL +
        "......" + NL +
        "......"));
    }
View Full Code Here

        "......"));
    }
   
    @Test
    public void shouldAllowUsersToToggleCells() {
        StringRenderer renderer = new StringRenderer();
        Game game = new Game(6, 4);
        game.setObserver(renderer);
        game.toggleCellAt(2, 1);
        assertThat(renderer.asString(), Matchers.equalTo(
        "......" + NL +
        "..X..." + NL +
        "......" + NL +
        "......"));
        game.toggleCellAt(2, 2);
        assertThat(renderer.asString(), Matchers.equalTo(
        "......" + NL +
        "..X..." + NL +
        "..X..." + NL +
        "......"));
        game.toggleCellAt(2, 1);
        assertThat(renderer.asString(), Matchers.equalTo(
        "......" + NL +
        "......" + NL +
        "..X..." + NL +
        "......"));
    }
View Full Code Here

TOP

Related Classes of com.lunivore.gameoflife.view.string.StringRenderer

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.