mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-07 18:49:34 +01:00
Added more test to PlayerTest
This commit is contained in:
parent
30a2379544
commit
bf63d608a7
@ -40,4 +40,70 @@ public class PlayerTest {
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
assertEquals(Action.MOVE_1,playerTest.getProgram().get(0).getAction());
|
||||
}
|
||||
@Test
|
||||
public void addMultipuleCards(){
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(30,Action.MOVE_2));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(23452342,Action.MOVE_3));
|
||||
assertEquals(Action.MOVE_1,playerTest.getProgram().get(0).getAction());
|
||||
assertEquals(Action.MOVE_2,playerTest.getProgram().get(1).getAction());
|
||||
assertEquals(Action.MOVE_3,playerTest.getProgram().get(2).getAction());
|
||||
}
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void addTooManyCardsGetsAError() {
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(30,Action.MOVE_2));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(234523423,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(2342342,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(23432342,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(234523242,Action.MOVE_3));
|
||||
}
|
||||
@Test
|
||||
public void removeCardsFromPlayerProgram() {
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(30,Action.MOVE_2));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(234523423,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(2342342,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(23432342,Action.MOVE_3));
|
||||
assertEquals(Action.MOVE_3,playerTest.getProgram().get(4).getAction());
|
||||
playerTest.removeProgramCard(4);
|
||||
assertEquals(null,playerTest.getProgram().get(4));
|
||||
}
|
||||
@Test
|
||||
public void removeAllCardsFromPlayerProgram() {
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(30,Action.MOVE_2));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(234523423,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(2342342,Action.MOVE_3));
|
||||
playerTest.setCardInProgram(new ProgrammingCard(23432342,Action.MOVE_3));
|
||||
assertEquals(Action.MOVE_3,playerTest.getProgram().get(4).getAction());
|
||||
assertEquals(Action.MOVE_3,playerTest.getProgram().get(3).getAction());
|
||||
assertEquals(Action.MOVE_3,playerTest.getProgram().get(2).getAction());
|
||||
assertEquals(Action.MOVE_2,playerTest.getProgram().get(1).getAction());
|
||||
assertEquals(Action.MOVE_1,playerTest.getProgram().get(0).getAction());
|
||||
playerTest.removeProgramCard(4);
|
||||
playerTest.removeProgramCard(3);
|
||||
playerTest.removeProgramCard(2);
|
||||
playerTest.removeProgramCard(1);
|
||||
playerTest.removeProgramCard(0);
|
||||
assertEquals(null,playerTest.getProgram().get(4));
|
||||
assertEquals(null,playerTest.getProgram().get(3));
|
||||
assertEquals(null,playerTest.getProgram().get(2));
|
||||
assertEquals(null,playerTest.getProgram().get(1));
|
||||
assertEquals(null,playerTest.getProgram().get(0));
|
||||
}
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void getErrorIfYouRemoveMoreThenIndexFive(){
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.removeProgramCard(5);
|
||||
|
||||
}
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void getErrorIfYouRemoveANegativIndex(){
|
||||
playerTest.setCardInProgram(new ProgrammingCard(10,Action.MOVE_1));
|
||||
playerTest.removeProgramCard(-1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user