Commit 416020ad authored by Younis's avatar Younis
Browse files

Add new file FußballvereinTest

parent 643cd1d3
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
import java.util.HashMap;
public class FußballvereinTest {
private Fußballverein club;
@Before
public void setUp() {
club = new Fußballverein();
}
@Test
public void testAddPlayer() {
club.addPlayer("Lionel Messi", 10);
club.addPlayer("Cristiano Ronaldo", 7);
HashMap<String, Integer> expected = new HashMap<>();
expected.put("Lionel Messi", 10);
expected.put("Cristiano Ronaldo", 7);
assertEquals(expected, club.getPlayers());
}
@Test
public void testRemovePlayer() {
club.addPlayer("Lionel Messi", 10);
club.addPlayer("Cristiano Ronaldo", 7);
club.removePlayer("Lionel Messi");
HashMap<String, Integer> expected = new HashMap<>();
expected.put("Cristiano Ronaldo", 7);
assertEquals(expected, club.getPlayers());
}
@Test
public void testGetPlayerNumber() {
club.addPlayer("Lionel Messi", 10);
club.addPlayer("Cristiano Ronaldo", 7);
assertEquals(10, club.getPlayerNumber("Lionel Messi"));
assertEquals(7, club.getPlayerNumber("Cristiano Ronaldo"));
}
@Test
public void testGetPlayerNumberNonExistent() {
assertEquals(-1, club.getPlayerNumber("Neymar"));
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment