create TeamTest
This commit is contained in:
parent
2e314497db
commit
df3fc5df2d
|
@ -34,8 +34,6 @@ public class LogConfiguration {
|
||||||
logger.fine("Getting and reading logconfig file from " + propertiesPath);
|
logger.fine("Getting and reading logconfig file from " + propertiesPath);
|
||||||
InputStream logConfig = this.getClass().getClassLoader().getResourceAsStream(propertiesPath);
|
InputStream logConfig = this.getClass().getClassLoader().getResourceAsStream(propertiesPath);
|
||||||
LogManager.getLogManager().readConfiguration(logConfig);
|
LogManager.getLogManager().readConfiguration(logConfig);
|
||||||
|
|
||||||
|
|
||||||
Logger.getLogger(LogConfiguration.class.getPackageName());
|
Logger.getLogger(LogConfiguration.class.getPackageName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,6 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Team represents a team that can be added to a tournament
|
* Class Team represents a team that can be added to a tournament
|
||||||
* (in the prototype there is no functionality for the team)
|
* (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
|
* @param name the new name to be set
|
||||||
*/
|
*/
|
||||||
public Team(String name) {
|
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);
|
setName(name);
|
||||||
players = new ArrayList<>();
|
players = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
|
@ -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")));
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue