Package com.wakaleo.gameoflife.domain

Examples of com.wakaleo.gameoflife.domain.Universe


    public static final String EMPTY_GRID = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

    @Test
    public void aNewUniverseShouldContainOnlyDeadCells() {
        Universe theUniverse = new Universe();
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(EMPTY_GRID));
    }
View Full Code Here


    @Test
    public void aUniverseSeededWithAnEmpyGridContentWillContainAnEmptyGrid() {

        String seededGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(seededGrid));
    }
View Full Code Here

    @Test
    public void aUniverseCanBeInitializedWithAnyDimension() {
        String expectedGrid = "....." + NEW_LINE + "....." + NEW_LINE + "....." + NEW_LINE + "....." + NEW_LINE + "";

        Universe theUniverse = new Universe(4, 5);
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(expectedGrid));

    }
View Full Code Here

        String seededGrid = "..." + NEW_LINE + ".*." + NEW_LINE + "..." + NEW_LINE + "";

        String expectedGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.spawnsANewGeneration();
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(expectedGrid));
    }
View Full Code Here

    @Test
    public void aUniverseSeededWithAGridWithLivingCellsContentWillContainThatGrid() {

        String seededGrid = "*.." + NEW_LINE + ".*." + NEW_LINE + "..*" + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(seededGrid));
    }
View Full Code Here

        String seededGrid = "..." + NEW_LINE + "***" + NEW_LINE + "..." + NEW_LINE + "";

        String expectedNextGeneration = ".*." + NEW_LINE + ".*." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.createNextGeneration();
        String currentGrid = theUniverse.getGrid();
        assertThat(currentGrid, is(expectedNextGeneration));
    }
View Full Code Here

    public void aUserCanAssignALiveCellAtAGivenPointInTheGrid() {
        String seededGrid = "..." + NEW_LINE + "..." + NEW_LINE + "..." + NEW_LINE + "";

        String expectedState = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.setLiveCellAt(0, 0);
        theUniverse.setLiveCellAt(1, 0);
        theUniverse.setLiveCellAt(2, 1);

        assertThat(theUniverse.getGrid(), is(expectedState));
    }
View Full Code Here

    public void aUserCanAssignADeadCellAtAGivenPointInTheGrid() {
        String seededGrid = "***" + NEW_LINE + "***" + NEW_LINE + "***" + NEW_LINE + "";

        String expectedState = "*.*" + NEW_LINE + "***" + NEW_LINE + "***" + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));
        theUniverse.setDeadCellAt(0, 1);
        assertThat(theUniverse.getGrid(), is(expectedState));
    }
View Full Code Here

    @Test
    public void aUserCanReadALiveCellValueAtAGivenPointInTheGrid() {
        String seededGrid = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));

        assertThat(theUniverse.getCellAt(0, 0), is(LIVE_CELL));
        assertThat(theUniverse.getCellAt(1, 0), is(LIVE_CELL));
        assertThat(theUniverse.getCellAt(2, 1), is(LIVE_CELL));
    }
View Full Code Here

    @Test
    public void aUserCanReadADeadCellValueAtAGivenPointInTheGrid() {
        String seededGrid = "*.." + NEW_LINE + "*.." + NEW_LINE + ".*." + NEW_LINE + "";

        Universe theUniverse = new Universe(seededWith(seededGrid));

        assertThat(theUniverse.getCellAt(0, 1), is(DEAD_CELL));
        assertThat(theUniverse.getCellAt(1, 1), is(DEAD_CELL));
    }
View Full Code Here

TOP

Related Classes of com.wakaleo.gameoflife.domain.Universe

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.