Upload project.
This commit is contained in:
19
test/state_pattern_tests/StateTransitionTest.java
Normal file
19
test/state_pattern_tests/StateTransitionTest.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package state_pattern_tests;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
|
||||
public class StateTransitionTest {
|
||||
|
||||
@Test
|
||||
public void StateTransitionTest()
|
||||
{
|
||||
ROV rov = new ROV();
|
||||
rov.move(new Location(5, 5, 5));
|
||||
assertEquals(rov.getStateName(), "Idle");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
71
test/state_pattern_tests/states/BusyActionStateTest.java
Normal file
71
test/state_pattern_tests/states/BusyActionStateTest.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package state_pattern_tests.states;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
import seabedexplorer.submersible.state.states.BusyActionState;
|
||||
import seabedexplorer.submersible.state.states.IdleState;
|
||||
|
||||
public class BusyActionStateTest {
|
||||
|
||||
public BusyActionStateTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateTestCanMove()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.canMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateTestMove()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertFalse(is.move(new Location(5, 5, 5)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStatesTestStopMove()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.stopMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateString()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertEquals(is.toString(), "Busy (Action in progress)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateReturnToVesel()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.returnToVessel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateCollectWater()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.collectWater());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateCollectMaterial()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.collectMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyActionStateCollectMapping()
|
||||
{
|
||||
BusyActionState is = new BusyActionState();
|
||||
assertFalse(is.collectMappingData());
|
||||
}
|
||||
}
|
||||
65
test/state_pattern_tests/states/BusyMoveStateTest.java
Normal file
65
test/state_pattern_tests/states/BusyMoveStateTest.java
Normal file
@@ -0,0 +1,65 @@
|
||||
package state_pattern_tests.states;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
import seabedexplorer.submersible.state.states.BusyMoveState;
|
||||
import seabedexplorer.util.movement.MovementEmulation;
|
||||
|
||||
|
||||
public class BusyMoveStateTest {
|
||||
|
||||
public BusyMoveStateTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateTestCanMove()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.canMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateTestMove()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.move(new Location(5, 5, 5)));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateString()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertEquals(is.toString(), "Busy (Movement in progress)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateReturnToVesel()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.returnToVessel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateCollectWater()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.collectWater());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateCollectMaterial()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.collectMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void BusyMoveStateCollectMapping()
|
||||
{
|
||||
BusyMoveState is = new BusyMoveState(new MovementEmulation(new ROV(), new Location(5, 5, 5)));
|
||||
assertFalse(is.collectMappingData());
|
||||
}
|
||||
}
|
||||
71
test/state_pattern_tests/states/DeployStateTest.java
Normal file
71
test/state_pattern_tests/states/DeployStateTest.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package state_pattern_tests.states;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
import seabedexplorer.submersible.state.states.DeployState;
|
||||
import seabedexplorer.submersible.state.states.IdleState;
|
||||
|
||||
public class DeployStateTest {
|
||||
|
||||
public DeployStateTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateTestCanMove()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.canMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateTestMove()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertFalse(is.move(new Location(5, 5, 5)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStatesTestStopMove()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.stopMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateString()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertEquals(is.toString(), "Deployed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateReturnToVesel()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.returnToVessel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateCollectWater()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.collectWater());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateCollectMaterial()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.collectMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DeployStateCollectMapping()
|
||||
{
|
||||
DeployState is = new DeployState();
|
||||
assertFalse(is.collectMappingData());
|
||||
}
|
||||
}
|
||||
71
test/state_pattern_tests/states/DockedStateTest.java
Normal file
71
test/state_pattern_tests/states/DockedStateTest.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package state_pattern_tests.states;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
import seabedexplorer.submersible.state.states.DockedState;
|
||||
import seabedexplorer.submersible.state.states.IdleState;
|
||||
|
||||
public class DockedStateTest {
|
||||
|
||||
public DockedStateTest() {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateTestCanMove()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertTrue(is.canMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateTestMove()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.move(new Location(5, 5, 5)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStatesTestStopMove()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertFalse(is.stopMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateString()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertEquals(is.toString(), "Docked");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateReturnToVesel()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertFalse(is.returnToVessel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateCollectWater()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertFalse(is.collectWater());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateCollectMaterial()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertFalse(is.collectMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void DockedStateCollectMapping()
|
||||
{
|
||||
DockedState is = new DockedState();
|
||||
assertFalse(is.collectMappingData());
|
||||
}
|
||||
}
|
||||
71
test/state_pattern_tests/states/IdleStateTest.java
Normal file
71
test/state_pattern_tests/states/IdleStateTest.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package state_pattern_tests.states;
|
||||
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import seabedexplorer.submersible.ROV;
|
||||
import seabedexplorer.submersible.equipment.locationtracking.Location;
|
||||
import seabedexplorer.submersible.state.states.IdleState;
|
||||
|
||||
public class IdleStateTest {
|
||||
|
||||
@Test
|
||||
public void IdleStateTestCanMove()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
assertTrue(is.canMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateTestMove()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.move(new Location(5, 5, 5)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStatesTestStopMove()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
assertFalse(is.stopMove());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateString()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
assertEquals(is.toString(), "Idle");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateReturnToVesel()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.returnToVessel());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateCollectWater()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.collectWater());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateCollectMaterial()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.collectMaterial());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void IdleStateCollectMapping()
|
||||
{
|
||||
IdleState is = new IdleState();
|
||||
is.submersibleInstance(new ROV());
|
||||
assertTrue(is.collectMappingData());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user