From 4fbe2b08302e79816bb072ddec386fa76f100d70 Mon Sep 17 00:00:00 2001 From: Nick Stolbov Date: Thu, 13 Jan 2022 13:34:05 +0100 Subject: [PATCH] Added Menu with test --- .gitignore | 1 + src/main/java/Application/Menu.java | 18 ++++++++++++++++++ src/test/java/Application/MenuTest.java | 24 ++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 src/main/java/Application/Menu.java create mode 100644 src/test/java/Application/MenuTest.java diff --git a/.gitignore b/.gitignore index 2f7896d..92322c4 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +.idea/ target/ diff --git a/src/main/java/Application/Menu.java b/src/main/java/Application/Menu.java new file mode 100644 index 0000000..9d898e0 --- /dev/null +++ b/src/main/java/Application/Menu.java @@ -0,0 +1,18 @@ +package Application; + +public class Menu { + + private String name; + + public Menu(String name){ + setName(name); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/src/test/java/Application/MenuTest.java b/src/test/java/Application/MenuTest.java new file mode 100644 index 0000000..f3cd75f --- /dev/null +++ b/src/test/java/Application/MenuTest.java @@ -0,0 +1,24 @@ +package Application; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class MenuTest { + + @BeforeEach + void setUp() { + } + + @AfterEach + void tearDown() { + } + + @Test + void testCorrectName(){ + Menu menu = new Menu("Item 1"); + assertTrue(menu.getName().equals("Item 1")); + } +} \ No newline at end of file