Browse Source

Added more additional USK Checkers + Tests

dev
Adem Berber 3 years ago
parent
commit
1b16fb91f1
  1. 58
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 14
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

58
projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java

@ -1411,4 +1411,62 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkUskSixteen() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 16) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkUskEighteen() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 18) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
}

14
projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

@ -247,5 +247,19 @@ public class GamesTest extends TestCase {
String actual = testObject.checkUskTwelve();
assertEquals(expected, actual);
}
public void test_checkUskSixteen() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Astral Chain, Breakdown, AI: The Somnium Files";
String actual = testObject.checkUskSixteen();
assertEquals(expected, actual);
}
public void test_checkUskEighteen() {
Games testObject = new Games();
String expected = "Yakuza: Dead Souls";
String actual = testObject.checkUskEighteen();
assertEquals(expected, actual);
}
}
Loading…
Cancel
Save