Browse Source

Added Unknown Release Checker + Test

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

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

@ -971,4 +971,34 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkReleaseDateUnknown() {
String result = "";
String query = "SELECT Game_Name, Game_Release_AU 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 gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
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

@ -163,4 +163,11 @@ public class GamesTest extends TestCase {
String actual = testObject.checkPublishersNa();
assertEquals(expected, actual);
}
public void test_checkReleaseDateUnknown() {
Games testObject = new Games();
String expected = "Breakdown, Atelier Totori Plus";
String actual = testObject.checkReleaseDateUnknown();
assertEquals(expected, actual);
}
}
Loading…
Cancel
Save