mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-04 03:33:45 +01:00 
			
		
		
		
	Legger til tester for partikkelklassen
This commit is contained in:
		@@ -0,0 +1,52 @@
 | 
			
		||||
package inf112.fiasko.roborally.objects;
 | 
			
		||||
 | 
			
		||||
import inf112.fiasko.roborally.element_properties.Direction;
 | 
			
		||||
import inf112.fiasko.roborally.element_properties.ParticleType;
 | 
			
		||||
import inf112.fiasko.roborally.element_properties.TileType;
 | 
			
		||||
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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user