From 46b885d0bb7335f63221a45d704deeb944d04f50 Mon Sep 17 00:00:00 2001 From: Adem Berber Date: Sat, 12 Feb 2022 22:36:09 +0100 Subject: [PATCH] Added Unknown Release Checker + Test --- .../java/de/hs_fulda/ciip/projjpn/Games.java | 30 +++++++++++++++++++ .../de/hs_fulda/ciip/projjpn/GamesTest.java | 7 +++++ 2 files changed, 37 insertions(+) diff --git a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java b/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java index 6c4f430..6ccee27 100644 --- a/projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java +++ b/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); + } } diff --git a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java b/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java index 667b734..09c7e46 100644 --- a/projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java +++ b/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); + } }