Initial commit of Mesos Java project
This commit is contained in:
64
src/test/java/Server/OfferingTileTest.java
Normal file
64
src/test/java/Server/OfferingTileTest.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package Server;
|
||||
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class OfferingTileTest {
|
||||
|
||||
OfferingTile offeringTile;
|
||||
|
||||
@Test
|
||||
void isEmpty() {
|
||||
|
||||
//test the ability of the method to recognize an occupied tile
|
||||
|
||||
OfferingTile offeringTile = new OfferingTile(4);
|
||||
|
||||
assertTrue(offeringTile.isEmpty());
|
||||
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void init(){
|
||||
offeringTile = new OfferingTile(4);
|
||||
offeringTile.setOccupant(new Player("Johnny", TotemColor.BLUE));
|
||||
}
|
||||
@Test
|
||||
void RemoveOccupant(){
|
||||
|
||||
//test that the occupant has been removed
|
||||
|
||||
assertNull(offeringTile.removeOccupant());
|
||||
}
|
||||
|
||||
@Test
|
||||
void GetOccupant(){
|
||||
|
||||
assertEquals("Johnny",offeringTile.getOccupant().getNickname());
|
||||
}
|
||||
|
||||
@Test
|
||||
void SetOccupant(){
|
||||
|
||||
//test that the player has been set
|
||||
|
||||
|
||||
assertEquals("Johnny",offeringTile.getOccupant().getNickname());
|
||||
}
|
||||
|
||||
@Test
|
||||
void getActions(){
|
||||
|
||||
//tests that the actions associated to tile are the correct ones
|
||||
OfferingTile offeringTile = new OfferingTile(4);
|
||||
|
||||
List<Symbol> correct = List.of(Symbol.DOWN,Symbol.UP);
|
||||
|
||||
assertEquals(correct,offeringTile.getActions());
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user