diff --git a/projjpn/GamesDB.accdb b/projjpn/GamesDB.accdb index f0c11c0..332543b 100644 Binary files a/projjpn/GamesDB.accdb and b/projjpn/GamesDB.accdb differ diff --git a/projjpn/GamesDB.laccdb b/projjpn/GamesDB.laccdb index 5a03e03..e69de29 100644 Binary files a/projjpn/GamesDB.laccdb and b/projjpn/GamesDB.laccdb differ 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 6b389ec..dab366d 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 @@ -478,4 +478,34 @@ public class Games { return result.substring(0, result.length() - 2); } + + public String checkConsoleNintendoSwitch() { + String result = ""; + String query = "SELECT Game_Name, Game_Console 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 gameConsole = resultSet.getString("Game_Console"); + + if (gameConsole.equals("Nintendo Switch")) { + 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 9168661..83d6fc7 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 @@ -100,4 +100,11 @@ public class GamesTest extends TestCase { String actual = testObject.checkConsoleMultiplatform(); assertEquals(expected, actual); } + + public void test_checkConsoleNintendoSwitch() { + Games testObject = new Games(); + String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Super Smash Bros. Ultimate"; + String actual = testObject.checkConsoleNintendoSwitch(); + assertEquals(expected, actual); + } }