Skip to content

Commit

Permalink
edit documentation for PlayerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanOswego committed Apr 26, 2018
1 parent de532e1 commit 05ff574
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 26 additions & 2 deletions Database/GameDB/src/test/java/com/csc480red/gamedb/PlayerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,40 +22,64 @@ public class PlayerTest {
@Autowired
PlayerRepository players;

/**
* adds a Gold team to the Team Repository
* adds a player to the Player Repository
*/
@Before
public void setup() {
Team gold = new Team("Gold");
Team green = new Team("Green");
Player player = new Player("brendan", "", gold);
entityManager.persist(gold);
entityManager.persist(green);
entityManager.persist(player);
}

/**
* should find the first player in the Player Repository
*/
@Test
public void getPlayer() {
Player player = players.findByUsername("brendan").get(0);
assertNotNull(player);
}

/**
* should not find a player in the Player Repository with
* the name 'doesnotexist' and the result of the query
* has length 0
*/
@Test
public void playerDoesNotExist() {
List<Player> temp = players.findByUsername("doesnotexist");
assertTrue(temp.size() == 0);
}

/**
* should not find a player in the Player Repository with
* an empty name and the result of the query
* has length 0
*/
@Test
public void playerWithEmptyName() {
List<Player> temp = players.findByUsername("");
assertTrue(temp.size() == 0);
}

/**
* should not find a player in the Player Repository with
* a null name and the result of the query
* has length 0
*/
@Test
public void playerWithNullName() {
List<Player> temp = players.findByUsername(null);
assertTrue(temp.size() == 0);
}

/**
* should allow player to play word, and
* updated the counter for words played
*/
@Test
public void playsWord() {
Player player = players.findByUsername("brendan").get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public class TeamTest {
@Autowired
PlayerRepository players;

/**
* adds a Green and Gold team to the Team Repository
* adds a player to the Player Repository
*/
@Before
public void setup() {
Team gold = new Team("Gold");
Expand Down

0 comments on commit 05ff574

Please sign in to comment.