|
|
@ -1,6 +1,7 @@ |
|
|
|
package Application; |
|
|
|
|
|
|
|
import org.junit.jupiter.api.AfterEach; |
|
|
|
import org.junit.jupiter.api.Assertions; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
@ -42,4 +43,29 @@ class MenuManagerTest { |
|
|
|
mm.select(0); |
|
|
|
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()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |