Browse Source

Added USK Checker + Test

dev
Adem Berber 3 years ago
parent
commit
dce812bdf3
  1. 29
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 7
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

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

@ -1324,4 +1324,33 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkUskZero() {
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 == 0) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
} }

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

@ -226,4 +226,11 @@ public class GamesTest extends TestCase {
String actual = testObject.checkOnePlayerOnly(); String actual = testObject.checkOnePlayerOnly();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkUskZero() {
Games testObject = new Games();
String expected = "Rhythm Paradise, Tomodachi Life, Beautiful Katamari";
String actual = testObject.checkUskZero();
assertEquals(expected, actual);
}
} }
Loading…
Cancel
Save