Package main.ch.morrolan.gibb.snake

Examples of main.ch.morrolan.gibb.snake.BodyPart


import main.ch.morrolan.gibb.snake.Painter;

@RunWith(JUnit4.class)
public class BodyPartTest {
    public BodyPart bodyPart1() {
        return new BodyPart(0, 0);
    }
View Full Code Here


    public BodyPart bodyPart1() {
        return new BodyPart(0, 0);
    }

    public BodyPart bodyPart2() {
        return new BodyPart(7, 2);
    }
View Full Code Here

        return mock(Painter.class);
    }

    @Test
    public void BodyPart() {
        BodyPart part = new BodyPart();
        assertEquals(Direction.DOWN, part.direction);
    }
View Full Code Here

        assertEquals(Direction.DOWN, part.direction);
    }

    @Test
    public void move() {
        BodyPart part = new BodyPart(0, 0);
        Point position = new Point(0, 0);

        part.direction = Direction.DOWN;
        part.move(1);
        position.y += 1;
        assertEquals(position, part.position);

        part.direction = Direction.RIGHT;
        part.move(5);
        position.x += 5;
        assertEquals(position, part.position);

        part.direction = Direction.UP;
        part.move(3);
        position.y -= 3;
        assertEquals(position, part.position);

        part.direction = Direction.LEFT;
        part.move(2);
        position.x -= 2;
        assertEquals(position, part.position);
    }
View Full Code Here

        assertEquals(position, part.position);
    }

    @Test
    public void draw() {
        BodyPart bodyPart;
        Painter painter;

        bodyPart = bodyPart1();
        painter = painterMock();
        bodyPart.draw(painter);
        verify(painter).fillOval(0, 0, 1, 1);

        bodyPart = bodyPart2();
        painter = painterMock();
        bodyPart.draw(painter);
        verify(painter).fillOval(7, 2, 1, 1);

    }
View Full Code Here

TOP

Related Classes of main.ch.morrolan.gibb.snake.BodyPart

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.