From f382b61b07122fe3a54673957a3f9931fa291237 Mon Sep 17 00:00:00 2001 From: Adem Berber Date: Sat, 12 Feb 2022 19:56:26 +0100 Subject: [PATCH] Refactored Class and Test File --- .../java/de/hs_fulda/ciip/projjpn/Games.java | 28 ++++++++++--------- .../de/hs_fulda/ciip/projjpn/GamesTest.java | 10 +++---- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java index 1757c0f..86cce3d 100644 --- a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java +++ b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java @@ -478,7 +478,7 @@ public class Games { return result.substring(0, result.length() - 2); } - + public String checkConsoleNintendoSwitch() { String result = ""; String query = "SELECT Game_Name, Game_Console FROM Games"; @@ -493,8 +493,8 @@ public class Games { String gameName = resultSet.getString("Game_Name"); String gameConsole = resultSet.getString("Game_Console"); - if (gameConsole.equals("Nintendo Switch")) { - result += gameName + ", "; + if (gameConsole.equals("Nintendo Switch")) { + result += gameName + ", "; } @@ -508,7 +508,7 @@ public class Games { return result.substring(0, result.length() - 2); } - + public String checkDeveloperAtlus() { String result = ""; String query = "SELECT Game_Name, Game_Developer FROM Games"; @@ -523,8 +523,8 @@ public class Games { String gameName = resultSet.getString("Game_Name"); String gameDeveloper = resultSet.getString("Game_Developer"); - if (gameDeveloper.equals("Atlus")) { - result += gameName + ", "; + if (gameDeveloper.equals("Atlus")) { + result += gameName + ", "; } @@ -538,7 +538,7 @@ public class Games { return result.substring(0, result.length() - 2); } - + public String checkDevelopers() { String result = ""; String query = "SELECT Game_Developer FROM Games"; @@ -581,7 +581,7 @@ public class Games { return result.substring(0, result.length() - 2); } - + public String checkPublisherNintendo() { String result = ""; String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games"; @@ -598,8 +598,9 @@ public class Games { String gamePublisherJp = resultSet.getString("Game_Publisher_JP"); String gamePublisherNa = resultSet.getString("Game_Publisher_NA"); - if (gamePublisherEu.equals("Nintendo") || gamePublisherJp.equals("Nintendo") || gamePublisherNa.equals("Nintendo")) { - result += gameName + ", "; + if (gamePublisherEu.equals("Nintendo") || gamePublisherJp.equals("Nintendo") + || gamePublisherNa.equals("Nintendo")) { + result += gameName + ", "; } @@ -613,7 +614,7 @@ public class Games { return result.substring(0, result.length() - 2); } - + public String checkPublisherSega() { String result = ""; String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games"; @@ -630,8 +631,9 @@ public class Games { String gamePublisherJp = resultSet.getString("Game_Publisher_JP"); String gamePublisherNa = resultSet.getString("Game_Publisher_NA"); - if (gamePublisherEu.equals("Sega") || gamePublisherJp.equals("Sega") || gamePublisherNa.equals("Sega")) { - result += gameName + ", "; + if (gamePublisherEu.equals("Sega") || gamePublisherJp.equals("Sega") + || gamePublisherNa.equals("Sega")) { + result += gameName + ", "; } diff --git a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java index f2fe48a..d155b17 100644 --- a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java +++ b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java @@ -100,35 +100,35 @@ public class GamesTest extends TestCase { String actual = testObject.checkConsoleMultiplatform(); assertEquals(expected, actual); } - + public void test_checkConsoleNintendoSwitch() { Games testObject = new Games(); String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Super Smash Bros. Ultimate"; String actual = testObject.checkConsoleNintendoSwitch(); assertEquals(expected, actual); } - + public void test_checkDeveloperAtlus() { Games testObject = new Games(); String expected = "Persona 5 Royal, Persona 3 Portable"; String actual = testObject.checkDeveloperAtlus(); assertEquals(expected, actual); } - + public void test_checkDevelopers() { Games testObject = new Games(); String expected = "Atlus, Insomniac Games, Platinum Games, Intelligent Systems, Artdink, Nintendo SPD, Sora Ltd., Ryu Ga Gotoku Studio, Sega Sports R&D, Namco, Spike Chunsoft, Bandai Namco Games, Gust Co. Ltd., Vicarious Visions"; String actual = testObject.checkDevelopers(); assertEquals(expected, actual); } - + public void test_checkPublisherNintendo() { Games testObject = new Games(); String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Rhythm Paradise, Super Smash Bros. Ultimate, Tomodachi Life"; String actual = testObject.checkPublisherNintendo(); assertEquals(expected, actual); } - + public void test_checkPublisherSega() { Games testObject = new Games(); String expected = "Persona 5 Royal, Yakuza: Dead Souls, Jet Set Radio Future";