diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/LogConfiguration.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/LogConfiguration.java index b15c578..6968dbb 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/LogConfiguration.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/LogConfiguration.java @@ -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()); } } diff --git a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java index 105562d..c67eedb 100644 --- a/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java +++ b/app/src/main/java/ch/zhaw/projekt2/turnierverwaltung/Team.java @@ -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<>(); } diff --git a/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/TeamTest.java b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/TeamTest.java new file mode 100644 index 0000000..2e53a38 --- /dev/null +++ b/app/src/test/java/ch/zhaw/projekt2/turnierverwaltung/TeamTest.java @@ -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"))); + } +}