Commit 877fe54a authored by babablaze's avatar babablaze

add CarteTest and PionTest. add methods in Plateau

parent bed0818f
......@@ -65,7 +65,7 @@ public class Plateau {
return reserve;
}
public PionAssimilation getPionAssimilation() {
public Pion getPionAssimilation() {
return pionAssimilation;
}
......@@ -73,11 +73,21 @@ public class Plateau {
this.pionAssimilation.setPosition(newPosition);
}
public PionSecours getPionSecours() {
public Pion getPionSecours() {
return pionSecours;
}
public void setPionSecoursPosition(int newPosition) {
this.pionSecours.setPosition(newPosition);
}
@Override
public String toString() {
return "Plateau{" +
"plateauCarte=" + plateauCarte +
", reserve=" + reserve +
", pionAssimilation=" + pionAssimilation +
", pionSecours=" + pionSecours +
'}';
}
}
package fr.univnantes.alma.game.composant.Carte;
import fr.univnantes.alma.game.database.Lieux.Abri;
import fr.univnantes.alma.game.database.Survie.Adrenaline;
import fr.univnantes.alma.game.database.Traque.Acharnement;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class CarteTest {
@BeforeEach
public void init(){
Carte carteLieux = new Abri();
Carte carteSurvie = new Adrenaline();
Carte carteTraque = new Acharnement();
}
@Test
public void testGetId(){
CarteLieu carteLieux = new Abri();
int numero = 7;
String nom = "Abri";
String pouvoir = "...";
assertEquals(carteLieux.getNumero(), numero);
assertEquals(carteLieux.getNom(), nom);
assertEquals(carteLieux.getPouvoir(), pouvoir);
}
@Test
public void testGetPhase(){
CarteSurvie carteSurvie = new Adrenaline();
int phase = 1;
assertEquals(carteSurvie.getPhase(), phase);
CarteTraque carteTraque = new Acharnement();
int phaseTraque = 2;
assertEquals(carteTraque.getPhase(), phaseTraque);
}
@Test
public void testgetSymbole(){
CarteTraque carteTraque = new Acharnement();
String symbole = "";
assertEquals(carteTraque.getSymbole(), symbole);
}
}
package fr.univnantes.alma.game.composant.Pion;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
public class PionTest {
@Test
public void testGetPosition(){
Pion pion = new Pion(7);
int nombre = 7;
int nombre2 = 3;
assertEquals(pion.getPosition(), nombre);
assertNotEquals(pion.getPosition(), nombre2);
}
@Test
public void testSetPosition(){
Pion pion = new Pion(7);
pion.setPosition(3);
int nombre = 7;
int nombre2 = 3;
assertEquals(pion.getPosition(), nombre2);
assertNotEquals(pion.getPosition(), nombre);
}
@Test
public void testToString(){
Pion pion = new Pion(7);
String message = "Pion{" + "position=" + pion.getPosition() + '}';
assertEquals(pion.toString(), message);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment