From 269eedaedb120c3b37c715688515b83383f36702 Mon Sep 17 00:00:00 2001 From: LiamOdero Date: Mon, 12 Sep 2022 17:48:22 -0400 Subject: [PATCH] Added testPersonalMethod to IntroLabTest and oderolia to IntroLab --- src/main/java/IntroLab.java | 7 ++++--- src/test/java/IntroLabTest.java | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/IntroLab.java b/src/main/java/IntroLab.java index fa5d6e2..8ba74db 100644 --- a/src/main/java/IntroLab.java +++ b/src/main/java/IntroLab.java @@ -4,15 +4,12 @@ * You should read this file from top-to-bottom. Any tasks you are to complete * are labelled with TODO! */ - public class IntroLab { /** * Returns a message depending on the given greeting, name, message, and * whether the caller likes cats or dogs more. - * * Do NOT change this method! - * * @param greeting A string with a greeting (e.g. "Hello", "Hey") * @param name A string with a name (e.g. "Jonathan", "Lindsey") * @param likes_cats A boolean: true if they like cats more than dogs, @@ -41,6 +38,10 @@ public static String printLabMessage(String greeting, String name, * Make sure you document your method properly! */ + public static String oderolia() { + return printLabMessage("Salutations", "Liam Odero", false, "message"); + } + /** * An example method that calls on printLabMessage. */ diff --git a/src/test/java/IntroLabTest.java b/src/test/java/IntroLabTest.java index 4572da6..c25dede 100644 --- a/src/test/java/IntroLabTest.java +++ b/src/test/java/IntroLabTest.java @@ -25,6 +25,14 @@ public void testExampleStudent() { assertEquals(expected, actual); } + + @Test(timeout = 10) + public void testPersonalMethod() { + String expected = "Salutations! My name is Liam Odero! I like dogs more than cats! message"; + String actual = IntroLab.oderolia(); + assertEquals(expected, actual); + } + /* TODO: Write a test case for the method you wrote in IntroLab. * If done properly, you should be able to run IntroLabTest and see * the test results.