From 783c425981c242a3727b7e911d35784269923bfb Mon Sep 17 00:00:00 2001 From: BlairCannon97 Date: Tue, 3 Oct 2023 10:48:52 +1000 Subject: [PATCH] Wrote tests for waves test suite --- .../game/components/tasks/waves/LevelWavesTest.java | 13 ++++--------- .../game/components/tasks/waves/WaveClassTest.java | 4 ++-- .../game/components/tasks/waves/WaveTaskTest.java | 4 ++-- .../game/entities/factories/WaveFactoryTest.java | 3 ++- 4 files changed, 10 insertions(+), 14 deletions(-) diff --git a/source/core/src/test/com/csse3200/game/components/tasks/waves/LevelWavesTest.java b/source/core/src/test/com/csse3200/game/components/tasks/waves/LevelWavesTest.java index b62fa0b6f..653c6fd09 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/waves/LevelWavesTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/waves/LevelWavesTest.java @@ -1,4 +1,4 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.waves; import com.csse3200.game.components.tasks.waves.LevelWaves; import com.csse3200.game.components.tasks.waves.WaveClass; @@ -18,7 +18,7 @@ @ExtendWith(GameExtension.class) @ExtendWith(MockitoExtension.class) -public class LevelWavesTest { +class LevelWavesTest { LevelWaves levelWaves; WaveClass wave; @@ -27,7 +27,7 @@ public class LevelWavesTest { @BeforeEach void setUp() { - levelWaves = new LevelWaves(2); + levelWaves = mock(LevelWaves.class); wave = mock(WaveClass.class); gameTime = mock(GameTime.class); } @@ -56,13 +56,8 @@ public void testGetNumWaves() { @Test public void testGetStartTime() { - when(gameTime.getTime()).thenReturn(1000L); + when(levelWaves.getStartTime()).thenReturn(1000L); assertEquals(1000L, levelWaves.getStartTime()); } - @Test - public void fail() { - assertTrue(false); - } - } diff --git a/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveClassTest.java b/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveClassTest.java index 691a3e156..08abdfbb0 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveClassTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveClassTest.java @@ -1,4 +1,4 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.waves; import com.csse3200.game.components.tasks.waves.WaveClass; import com.csse3200.game.extensions.GameExtension; @@ -16,7 +16,7 @@ @ExtendWith(GameExtension.class) @ExtendWith(MockitoExtension.class) -public class WaveClassTest { +class WaveClassTest { HashMap waveContents; WaveClass waveClass; diff --git a/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveTaskTest.java b/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveTaskTest.java index 155013e27..a4dd28248 100644 --- a/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveTaskTest.java +++ b/source/core/src/test/com/csse3200/game/components/tasks/waves/WaveTaskTest.java @@ -1,4 +1,4 @@ -package com.csse3200.game.components.tasks; +package com.csse3200.game.components.tasks.waves; import com.badlogic.gdx.audio.Sound; import com.csse3200.game.ai.tasks.PriorityTask; @@ -26,7 +26,7 @@ @ExtendWith(GameExtension.class) @ExtendWith(MockitoExtension.class) -public class WaveTaskTest { +class WaveTaskTest { WaveTask waveTask; ResourceService resourceService; diff --git a/source/core/src/test/com/csse3200/game/entities/factories/WaveFactoryTest.java b/source/core/src/test/com/csse3200/game/entities/factories/WaveFactoryTest.java index d154e1a6b..b205fa6c0 100644 --- a/source/core/src/test/com/csse3200/game/entities/factories/WaveFactoryTest.java +++ b/source/core/src/test/com/csse3200/game/entities/factories/WaveFactoryTest.java @@ -1,5 +1,6 @@ package com.csse3200.game.entities.factories; +import com.csse3200.game.components.tasks.waves.LevelWaves; import com.csse3200.game.extensions.GameExtension; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; @@ -11,6 +12,6 @@ class WaveFactoryTest { @BeforeEach void setUp() { - + LevelWaves levelWaves = (LevelWaves) WaveFactory.createWaves(); } }