mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-03-14 14:09:44 +01:00
52 lines
1.5 KiB
Java
52 lines
1.5 KiB
Java
package inf112.fiasko.roborally.objects;
|
|
|
|
import inf112.fiasko.roborally.element_properties.Direction;
|
|
import inf112.fiasko.roborally.element_properties.ParticleType;
|
|
import org.junit.Before;
|
|
import org.junit.Test;
|
|
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertNull;
|
|
|
|
public class ParticleTest {
|
|
private Particle particle;
|
|
private Particle particle2;
|
|
|
|
@Before
|
|
public void setUp() {
|
|
particle = new Particle(ParticleType.LASER_BEAM_SINGLE, Direction.NORTH);
|
|
particle2 = new Particle(ParticleType.LASER_BEAM_DOUBLE_CROSS, Direction.EAST);
|
|
}
|
|
|
|
@Test
|
|
public void getParticleTypeFromParticle() {
|
|
assertEquals(ParticleType.LASER_BEAM_SINGLE, particle.getParticleType());
|
|
}
|
|
|
|
@Test
|
|
public void getParticleTypeFromParticle2() {
|
|
assertEquals(ParticleType.LASER_BEAM_DOUBLE_CROSS, particle2.getParticleType());
|
|
}
|
|
|
|
|
|
@Test
|
|
public void getDirectionFromParticle() {
|
|
assertEquals(Direction.NORTH, particle.getDirection());
|
|
}
|
|
|
|
@Test
|
|
public void getDirectionFromParticle2() {
|
|
assertEquals(Direction.EAST, particle2.getDirection());
|
|
}
|
|
|
|
@Test
|
|
public void invalidParticleTypeIDReturnsNull() {
|
|
assertNull(ParticleType.getParticleTypeFromID(-1));
|
|
}
|
|
|
|
@Test (expected = IllegalArgumentException.class)
|
|
public void invalidParticleDirectionThrowsError() {
|
|
new Particle(ParticleType.LASER_BEAM_DOUBLE, Direction.NORTH_EAST);
|
|
}
|
|
}
|