private void setup() {
    this.mockedModel = mock(Model.class);

    this.mockedGridModelPart = mock(GridModelPart.class);
    when(this.mockedModel.getPart(ModelPartRegistry.GRID_MODEL_PART))
        .thenReturn(this.mockedGridModelPart);

    this.mockedMyGrid = mock(Grid.class);
    when(this.mockedGridModelPart.getMyGrid()).thenReturn(this.mockedMyGrid);

    this.mockedMyAgent = mock(Agent.class);
    when(this.mockedGridModelPart.getMyAgent()).thenReturn(this.mockedMyAgent);

    this.mockedPacmanAgent = mock(Agent.class);
    when(this.mockedMyGrid.getAgent("pacman")).thenReturn(this.mockedPacmanAgent);

    this.mockedMySector = mock(Sector.class);
    mockPosition = mock(Point.class);
    when(mockedMyGrid.getSectorAt(mockPosition)).thenReturn(mockedMySector);
    when(mockedMyGrid.getPositionOf(mockedMyAgent)).thenReturn(mockPosition);
    when(this.mockedGridModelPart.getMySector()).thenReturn(this.mockedMySector);

    this.mockedNorthSector = mock(Sector.class);
    this.mockedEastSector = mock(Sector.class);
    this.mockedSouthSector = mock(Sector.class);
    this.mockedWestSector = mock(Sector.class);

    when(this.mockedMySector.getNeighbour(Bearing.N)).thenReturn(this.mockedNorthSector);
    when(this.mockedMySector.getNeighbour(Bearing.E)).thenReturn(this.mockedEastSector);
    when(this.mockedMySector.getNeighbour(Bearing.S)).thenReturn(this.mockedSouthSector);
    when(this.mockedMySector.getNeighbour(Bearing.W)).thenReturn(this.mockedWestSector);

    this.mode = new ChaseHillClimbingNavigatorMode(this.mockedModel);
  }
  public void testReachedGoalBecausePacmanIsAtWest() {
    this.setup();
    mockPosition = mock(Point.class);
    when(mockedMyGrid.getSectorAt(mockPosition)).thenReturn(mockedWestSector);
    when(mockedMyGrid.getPositionOf(mockedPacmanAgent)).thenReturn(mockPosition);

    assertTrue(this.mode.reachedGoal());
  }
  public void testNotReachedGoal() {
    this.setup();
    mockPosition = mock(Point.class);
    when(mockedMyGrid.getSectorAt(mockPosition)).thenReturn(mockUnknownSector());
    when(mockedMyGrid.getPositionOf(mockedPacmanAgent)).thenReturn(mockPosition);

    assertFalse(this.mode.reachedGoal());
  }