|
@ -1,6 +1,7 @@ |
|
|
package Application; |
|
|
package Application; |
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.AfterEach; |
|
|
import org.junit.jupiter.api.AfterEach; |
|
|
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
@ -28,7 +29,7 @@ class MenuManagerTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void testSelectFunction(){ |
|
|
|
|
|
|
|
|
void testSelectFunction() { |
|
|
assertEquals(mm.getCurrentMenu(), rootMenu); |
|
|
assertEquals(mm.getCurrentMenu(), rootMenu); |
|
|
mm.select(0); |
|
|
mm.select(0); |
|
|
assertEquals(mm.getCurrentMenu(), rootMenu.getMenu(0)); |
|
|
assertEquals(mm.getCurrentMenu(), rootMenu.getMenu(0)); |
|
@ -37,9 +38,34 @@ class MenuManagerTest { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Test |
|
|
@Test |
|
|
void testIsRootMenuFunction(){ |
|
|
|
|
|
|
|
|
void testIsRootMenuFunction() { |
|
|
assertTrue(mm.inRootMenu()); |
|
|
assertTrue(mm.inRootMenu()); |
|
|
mm.select(0); |
|
|
mm.select(0); |
|
|
assertFalse(mm.inRootMenu()); |
|
|
assertFalse(mm.inRootMenu()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testBackFunction() { |
|
|
|
|
|
try { |
|
|
|
|
|
mm.back(); |
|
|
|
|
|
Assertions.fail("Test failed: shouldn't be able to go back in rootMenu"); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
//Should throw Exception because currently in rootMenu |
|
|
|
|
|
} |
|
|
|
|
|
mm.select(0); |
|
|
|
|
|
try { |
|
|
|
|
|
mm.back(); |
|
|
|
|
|
assertEquals(mm.getCurrentMenu(), rootMenu); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
Assertions.fail("Test failed: " + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
mm.select(0); |
|
|
|
|
|
mm.select(0); |
|
|
|
|
|
try { |
|
|
|
|
|
mm.back(); |
|
|
|
|
|
assertEquals(mm.getCurrentMenu(), rootMenu.getMenu(0)); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
Assertions.fail("Test failed: " + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |