From 7497e9425f907794091e4fe3518051a47c2757db Mon Sep 17 00:00:00 2001 From: lungerjo Date: Mon, 12 Sep 2022 21:36:31 -0400 Subject: [PATCH 1/2] I think I got it... --- src/main/java/IntroLab.java | 11 ++++++++++- src/test/java/IntroLabTest.java | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/IntroLab.java b/src/main/java/IntroLab.java index fa5d6e2..eb1995b 100644 --- a/src/main/java/IntroLab.java +++ b/src/main/java/IntroLab.java @@ -10,7 +10,6 @@ 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") @@ -41,6 +40,13 @@ public static String printLabMessage(String greeting, String name, * Make sure you document your method properly! */ + public static String lungerjo(){ + + return printLabMessage("Hi", "Josh Lunger", false, + "I am looking forward to designing some software!"); + + } + /** * An example method that calls on printLabMessage. */ @@ -60,6 +66,9 @@ public static void main(final String[] args) { * above. Afterwards: run this file to see the output! */ + String message = lungerjo(); + System.out.println(message); + } diff --git a/src/test/java/IntroLabTest.java b/src/test/java/IntroLabTest.java index 4572da6..636f22e 100644 --- a/src/test/java/IntroLabTest.java +++ b/src/test/java/IntroLabTest.java @@ -25,9 +25,19 @@ public void testExampleStudent() { 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. * As a reference, we've included testExampleStudent above. */ + + @Test + public void testMessage(){ + String expected = "Hi! My name is Josh Lunger! " + + "I like dogs more than cats! I am looking forward to designing some software!"; + String actual = IntroLab.lungerjo(); + assertEquals(expected, actual); + } + } From da0954e36fe836455f34daa3fc8f52e2e1e82954 Mon Sep 17 00:00:00 2001 From: masonhhhh Date: Thu, 15 Sep 2022 17:26:46 -0400 Subject: [PATCH 2/2] mason --- src/main/java/IntroLab.java | 9 +++++---- src/test/java/IntroLabTest.java | 8 ++++++++ 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/IntroLab.java b/src/main/java/IntroLab.java index eb1995b..a3b1b28 100644 --- a/src/main/java/IntroLab.java +++ b/src/main/java/IntroLab.java @@ -40,16 +40,17 @@ public static String printLabMessage(String greeting, String name, * Make sure you document your method properly! */ - public static String lungerjo(){ + public static String lungerjo() { return printLabMessage("Hi", "Josh Lunger", false, "I am looking forward to designing some software!"); + } + public static String huyizhi1() { + return printLabMessage("Hi", "Mason Hu", false, + "I am looking forward to designing some software!"); } - /** - * An example method that calls on printLabMessage. - */ public static String exampleStudent() { return printLabMessage("Hello", "Stu Dent", true, "Welcome to CSC207!"); diff --git a/src/test/java/IntroLabTest.java b/src/test/java/IntroLabTest.java index 636f22e..9cfa7ff 100644 --- a/src/test/java/IntroLabTest.java +++ b/src/test/java/IntroLabTest.java @@ -40,4 +40,12 @@ public void testMessage(){ assertEquals(expected, actual); } + @Test + public void testhuyizhi1() { + String expected = "Hi! My name is Mason Hu! " + + "I like dogs more than cats! I am looking forward to designing some software!"; + String actual = IntroLab.huyizhi1(); + assertEquals(expected, actual); + } + }