You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package de.edu.hsfulda.ciip.tdd;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.not; import static org.junit.Assert.*;
import java.util.Arrays; import java.util.List;
import org.junit.Rule; import org.junit.Test; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule;
public class StatusAliveTest {
@Rule public MockitoRule mockitoRule = MockitoJUnit.rule();
@Mock State dead;
@Test public void changeToDeadIfOneAliveNeighbor() { // arrange
State stateAlive = new StateAlive(); List<State> neigborStates = Arrays.asList(stateAlive,dead,dead,dead,dead,dead,dead,dead);
// act
State result = stateAlive.nextBy(neigborStates);
// assert
assertNotNull("",result); assertThat("changed to dead", result.getClass(), not(equalTo(stateAlive.getClass()))); } @Test public void KeepSateAliveWithTwoLivingNeighbors() { // arrange
State stateAlive = new StateAlive(); List<State> neigborStates = Arrays.asList(stateAlive,stateAlive,dead,dead,dead,dead,dead,dead); // act
State result = stateAlive.nextBy(neigborStates);
// assert
assertNotNull("",result); assertThat("Still alive", result.getClass(), (equalTo(stateAlive.getClass()))); } }
|