|
@ -4,6 +4,8 @@ import org.junit.jupiter.api.AfterEach; |
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
import org.junit.jupiter.api.Test; |
|
|
import org.junit.jupiter.api.Test; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
import static org.junit.jupiter.api.Assertions.*; |
|
|
|
|
|
|
|
|
class MenuTest { |
|
|
class MenuTest { |
|
@ -21,4 +23,16 @@ class MenuTest { |
|
|
Menu menu = new Menu("Item 1"); |
|
|
Menu menu = new Menu("Item 1"); |
|
|
assertTrue(menu.getName().equals("Item 1")); |
|
|
assertTrue(menu.getName().equals("Item 1")); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
void testAddMenuFunction(){ |
|
|
|
|
|
ArrayList<Menu> menus = new ArrayList<>(); |
|
|
|
|
|
Menu menu1 = new Menu("Menu 1"); |
|
|
|
|
|
Menu menu2 = new Menu("Menu 2"); |
|
|
|
|
|
Menu menu1_1 = new Menu("Menu 1.1"); |
|
|
|
|
|
menu1.addMenu(menu1_1); |
|
|
|
|
|
menus.add(menu1); |
|
|
|
|
|
menus.add(menu2); |
|
|
|
|
|
assertTrue(menus.get(0).equals(menu1) && menus.get(1).equals(menu2) && menus.get(0).getSubMenuList().get(0).equals(menu1_1)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |