-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added some basic tests into WaveTaskTest. Added a new method into Wav…
…eTask to return the sounds Array.
- Loading branch information
1 parent
c1d2ad6
commit 251b0a6
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
source/core/src/test/com/csse3200/game/components/tasks/waves/WaveTaskTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,55 @@ | ||
package com.csse3200.game.components.tasks.waves; | ||
|
||
import com.badlogic.gdx.audio.Sound; | ||
import com.csse3200.game.components.tasks.DroidCombatTask; | ||
import com.csse3200.game.extensions.GameExtension; | ||
import com.csse3200.game.services.GameTime; | ||
import com.csse3200.game.services.ResourceService; | ||
import com.csse3200.game.services.ServiceLocator; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
import org.mockito.junit.jupiter.MockitoExtension; | ||
|
||
import java.util.logging.Level; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@ExtendWith(GameExtension.class) | ||
@ExtendWith(MockitoExtension.class) | ||
class WaveTaskTest { | ||
|
||
WaveTask waveTask; | ||
ResourceService resourceService; | ||
LevelWaves level; | ||
@BeforeEach | ||
void setUp() { | ||
resourceService = ServiceLocator.getResourceService(); | ||
GameTime globalTime = mock(GameTime.class); | ||
level = mock(LevelWaves.class); | ||
ServiceLocator.registerTimeSource(globalTime); | ||
waveTask = new WaveTask(); | ||
} | ||
|
||
@Test | ||
public void testLoadSounds() { | ||
String[] sounds = waveTask.getSounds(); | ||
resourceService.getAsset(sounds[0], Sound.class); | ||
resourceService.getAsset(sounds[1], Sound.class); | ||
} | ||
|
||
@Test | ||
public void testGetPriority() { | ||
int priority = waveTask.getPriority(); | ||
assertEquals(10, priority); | ||
} | ||
|
||
@Test | ||
public void testStartWave() { | ||
WaveTask waveTask = new WaveTask(); | ||
waveTask.start(); | ||
assertEquals(1, waveTask.getPriority()); | ||
} | ||
|
||
} |