Browse Source

Added More Additional ACB Checkers + Tests

dev
Adem Berber 3 years ago
parent
commit
793305e873
  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

@ -1991,4 +1991,62 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbMaFifteen() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_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");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("MA 15+")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkAcbReighteen() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_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");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("R 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

@ -387,4 +387,18 @@ public class GamesTest extends TestCase {
String actual = testObject.checkAcbM(); String actual = testObject.checkAcbM();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbMaFifteen() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable";
String actual = testObject.checkAcbMaFifteen();
assertEquals(expected, actual);
}
public void test_checkAcbReighteen() {
Games testObject = new Games();
String expected = "Atelier Totori Plus";
String actual = testObject.checkAcbReighteen();
assertEquals(expected, actual);
}
} }
Loading…
Cancel
Save