From 88cf31baacc7fa5b675d3a7c91f689cc78c9c265 Mon Sep 17 00:00:00 2001 From: Maxim Volkov Date: Thu, 10 Feb 2022 22:02:39 +0100 Subject: [PATCH] Feature: Title to Uppercase --- .../java/de/hs_fulda/ciip/hello_world/App.java | 9 +++++++++ .../de/hs_fulda/ciip/hello_world/AppTest.java | 16 +++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/hello-world/src/main/java/de/hs_fulda/ciip/hello_world/App.java b/hello-world/src/main/java/de/hs_fulda/ciip/hello_world/App.java index d981af8..39edb1b 100644 --- a/hello-world/src/main/java/de/hs_fulda/ciip/hello_world/App.java +++ b/hello-world/src/main/java/de/hs_fulda/ciip/hello_world/App.java @@ -13,6 +13,7 @@ public class App private String firstName; private String lastName; + private String title; public void setFirstName(String firstName) { this.firstName = firstName; @@ -25,5 +26,13 @@ public class App public String getFullName() { return firstName + " " + lastName; } + + public void setTitle(String title) { + this.title = title.toUpperCase(); + } + + public String getTitle() { + return title; + } } diff --git a/hello-world/src/test/java/de/hs_fulda/ciip/hello_world/AppTest.java b/hello-world/src/test/java/de/hs_fulda/ciip/hello_world/AppTest.java index 32f3931..df5251d 100644 --- a/hello-world/src/test/java/de/hs_fulda/ciip/hello_world/AppTest.java +++ b/hello-world/src/test/java/de/hs_fulda/ciip/hello_world/AppTest.java @@ -31,7 +31,6 @@ public class AppTest extends TestCase { assertTrue(true); } - public void testFullName() { // Arrange String expected = "Maxim Volkov"; @@ -47,4 +46,19 @@ public class AppTest extends TestCase { // Assert assertEquals(expected, actual); } + + public void testIsTitle() { + // Arrange + String expectedTitleUppercase = "NICE"; + String title = "nIcE"; + + // Act + App m = new App(); + m.setTitle(title); + String actual = m.getTitle(); + + + // Assert + assertEquals(expectedTitleUppercase, actual); + } }