create TeamTest

This commit is contained in:
Andrin Fassbind 2022-05-13 22:22:39 +02:00
parent 2e314497db
commit df3fc5df2d
3 changed files with 32 additions and 4 deletions

View File

@ -34,8 +34,6 @@ public class LogConfiguration {
logger.fine("Getting and reading logconfig file from " + propertiesPath);
InputStream logConfig = this.getClass().getClassLoader().getResourceAsStream(propertiesPath);
LogManager.getLogManager().readConfiguration(logConfig);
Logger.getLogger(LogConfiguration.class.getPackageName());
}
}

View File

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
/**
* Class Team represents a team that can be added to a tournament
* (in the prototype there is no functionality for the team)
@ -22,7 +21,7 @@ public class Team implements Participant {
* @param name the new name to be set
*/
public Team(String name) {
logger.fine("Setting the new name of the team as: " + name);
logger.fine("Setting the new name of the team as: " + name);
setName(name);
players = new ArrayList<>();
}

View File

@ -0,0 +1,31 @@
package ch.zhaw.projekt2.turnierverwaltung;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
public class TeamTest {
private Team team;
@Test
@DisplayName("Team Params")
void testParams() {
Player player = Mockito.mock(Player.class);
team = new Team("Team1");
for (int i = 0; i < 3; i++) {
Assertions.assertEquals(i,team.getPlayers().size());
team.addPlayer(player);
}
}
@Test
@DisplayName("Team Equals")
void equalTeam() {
team = new Team("A");
Assertions.assertTrue(team.equals(team));
Assertions.assertTrue(team.equals(new Team("A")));
Assertions.assertFalse(team.equals(new Team("B")));
}
}