-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added another game reset function, TODO: one function for instanceNr …
…resets
- Loading branch information
1 parent
a296664
commit 4bfbfd8
Showing
3 changed files
with
284 additions
and
281 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,71 @@ | ||
package tests; | ||
|
||
import org.junit.jupiter.api.*; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import src.*; | ||
import tests.HelperClasses.*; | ||
|
||
public class DrainTest { | ||
|
||
private Game game; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
game = new Game(System.out); | ||
Drain.SetGame(game); | ||
|
||
} | ||
|
||
@Test | ||
public void testGetInstanceNr() { | ||
int initialInstanceNr = Drain.GetInstanceNr(); | ||
Drain drain1 = new Drain(); | ||
assertEquals(initialInstanceNr + 1, Drain.GetInstanceNr()); | ||
} | ||
|
||
@Test | ||
public void testPullWater() { | ||
Source source = new Source(); | ||
TestPipe pipe = new TestPipe(); | ||
Drain drain = new Drain(); | ||
|
||
source.ConnectPipe(pipe); | ||
drain.ConnectPipe(pipe); | ||
|
||
source.Step(); | ||
pipe.Step(); | ||
drain.Step(); | ||
|
||
assertNotEquals(0, game.GetMechanicPoint()); | ||
} | ||
|
||
@Test | ||
public void testPickUpPump() { | ||
// Create a Drain instance | ||
Drain drain = new Drain(); | ||
// Pick up a pump | ||
Pump pump = drain.PickUpPump(); | ||
// Verify that a pump is picked up | ||
assertNotNull(pump); | ||
} | ||
|
||
@Test | ||
public void testPickUpPipe() { | ||
// Create a Drain instance | ||
Drain drain = new Drain(); | ||
// Pick up a pipe | ||
Pipe pipe = drain.PickUpPipe(); | ||
// Verify that a pipe is picked up | ||
assertNotNull(pipe); | ||
} | ||
|
||
@AfterEach | ||
public void cleanUp() { | ||
TestPump.setInstanceNr(0); | ||
TestPipe.setInstanceNr(0); | ||
TestSource.setInstanceNr(0); | ||
} | ||
} | ||
package tests; | ||
|
||
import org.junit.jupiter.api.*; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import src.*; | ||
import tests.HelperClasses.*; | ||
|
||
public class DrainTest { | ||
|
||
private Game game; | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
game = new Game(System.out); | ||
Drain.SetGame(game); | ||
|
||
} | ||
|
||
@Test | ||
public void testGetInstanceNr() { | ||
int initialInstanceNr = Drain.GetInstanceNr(); | ||
Drain drain1 = new Drain(); | ||
assertEquals(initialInstanceNr + 1, Drain.GetInstanceNr()); | ||
} | ||
|
||
@Test | ||
public void testPullWater() { | ||
Source source = new Source(); | ||
TestPipe pipe = new TestPipe(); | ||
Drain drain = new Drain(); | ||
|
||
source.ConnectPipe(pipe); | ||
drain.ConnectPipe(pipe); | ||
|
||
source.Step(); | ||
pipe.Step(); | ||
drain.Step(); | ||
|
||
assertNotEquals(0, game.GetMechanicPoint()); | ||
} | ||
|
||
@Test | ||
public void testPickUpPump() { | ||
// Create a Drain instance | ||
Drain drain = new Drain(); | ||
// Pick up a pump | ||
Pump pump = drain.PickUpPump(); | ||
// Verify that a pump is picked up | ||
assertNotNull(pump); | ||
} | ||
|
||
@Test | ||
public void testPickUpPipe() { | ||
// Create a Drain instance | ||
Drain drain = new Drain(); | ||
// Pick up a pipe | ||
Pipe pipe = drain.PickUpPipe(); | ||
// Verify that a pipe is picked up | ||
assertNotNull(pipe); | ||
} | ||
|
||
@AfterEach | ||
public void cleanUp() { | ||
TestPump.setInstanceNr(0); | ||
TestPipe.setInstanceNr(0); | ||
TestSource.setInstanceNr(0); | ||
TestDrain.setInstanceNr(0); | ||
} | ||
} |
Oops, something went wrong.