Skip to content
Snippets Groups Projects
Verified Commit 9e6d9be0 authored by Biryuk, Volodymyr's avatar Biryuk, Volodymyr
Browse files

Add unit test for turtle

parent 759cb9e8
Branches
No related tags found
1 merge request!3Remove redundant colors and method to get colors
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.*;
import java.awt.*;
/**
* The test class TurtleTest.
*
* @author Volodymyr Biryuk
* @version 30. November 2023
*/
public class TurtleTest
{
private Turtle _turtle;
/**
* Default constructor for test class TurtleTest
*/
public TurtleTest()
{
}
/**
* Sets up the test fixture.
*
* Called before every test case method.
*/
@BeforeEach
public void setUp()
{
_turtle = new Turtle();
}
@Test
public void farbenTest()
{
Color[] expected =
{
Color.BLACK, Color.BLUE, Color.CYAN, Color.DARK_GRAY, Color.GRAY, Color.GREEN,
Color.LIGHT_GRAY, Color.MAGENTA, Color.PINK, Color.YELLOW
};
Color[] actual = _turtle.gibFarben();
assertEquals(expected.length, actual.length);
for(int i = 0; i < actual.length; i++)
{
Color actual_ = actual[i];
Color expected_ = expected[i];
assertEquals(expected_, actual_);
}
}
/**
* Tears down the test fixture.
*
* Called after every test case method.
*/
@AfterEach
public void tearDown()
{
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment