Skip to content

Commit

Permalink
MultiplayerSession Unit Tests - Entities
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoDiNu committed Apr 26, 2024
1 parent ccc1a72 commit 704843a
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/test/java/com/uniovi/Wiq_UnitTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -1645,6 +1645,65 @@ public void testChangeScore() {
Assertions.assertNotNull(multiplayerSession);
}


@Test
@Order(101)
public void testMultiplayerIdGeneration() {
MultiplayerSession multiplayerSession = new MultiplayerSession();
multiplayerSessionRepository.save(multiplayerSession);

Long id = multiplayerSession.getId();
Assertions.assertNotNull(id);
}


@Test
@Order(102)
public void testMultiplayerCodeInitialization() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);

Integer multiplayerCode = player.getMultiplayerCode();
Assertions.assertNull(multiplayerCode);
}

@Test
@Order(103)
public void testScoreMultiplayerCodeInitialization() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);

String scoreMultiplayerCode = player.getScoreMultiplayerCode();
Assertions.assertNull(scoreMultiplayerCode);
}

@Test
@Order(104)
public void testMultiplayerCodeAssignment() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);

player.setMultiplayerCode(123);
Integer multiplayerCode = player.getMultiplayerCode();
Assertions.assertEquals(123, multiplayerCode);
}

@Test
@Order(105)
public void testScoreMultiplayerCodeAssignment() {
Long playerId = 1L;
Player player = createPlayer();
player.setId(playerId);

player.setScoreMultiplayerCode("200");
String scoreMultiplayerCode = player.getScoreMultiplayerCode();
Assertions.assertEquals("200", scoreMultiplayerCode);
}


/**
* Sends an HTTP request to the API
* @param method HTTP method
Expand Down

0 comments on commit 704843a

Please sign in to comment.