Browse Source

Refactored Class and Test File

dev
Adem Berber 2 years ago
parent
commit
f382b61b07
  1. 28
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 10
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

28
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 + ", ";
}

10
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";

Loading…
Cancel
Save