From 9236d77c54d3827c082249a481d6fc8f79d81472 Mon Sep 17 00:00:00 2001 From: Adem Berber Date: Sat, 12 Feb 2022 19:13:41 +0100 Subject: [PATCH] Added Nintendo Switch Console Checker + Test --- projjpn/GamesDB.accdb | Bin 1015808 -> 1015808 bytes projjpn/GamesDB.laccdb | Bin 64 -> 0 bytes .../java/de/hs_fulda/ciip/projjpn/Games.java | 30 ++++++++++++++++++ .../de/hs_fulda/ciip/projjpn/GamesTest.java | 7 ++++ 4 files changed, 37 insertions(+) diff --git a/projjpn/GamesDB.accdb b/projjpn/GamesDB.accdb index f0c11c07f60b3ee4e594324152aca738ce380672..332543baa35d0f3bad171931a275406072b7362e 100644 GIT binary patch delta 133 zcmZo@uxn_r+rY%f#KE#zfbRq2WCcE+CV_1Nj3@Y59W|$NO`m>Nj!}})ul>0kBM>tI zF*6XeY=17tD!q_LliMfE(T4#D{28VT9AK@Qu5f@=X?fQHR`&K)$60}x4TwQ(4j|?P UVlE)&24Wr{=H0&PIA7Qf07tPf+yDRo delta 131 zcmZo@uxn_r+rY%f^n!V_0N)43$qIZtO#<5l7*FuAX1zLEpECWd9HS(oUHfx6Mj&Pa zVrC#_+5TLPReB+hC$~?SqYncR*fUHQIKW!7eANL~_K6!5+E*QC1!6WJW(Q&pAm#*O TE+FOxVjdvo-M;ELU)T-+0Sz+z diff --git a/projjpn/GamesDB.laccdb b/projjpn/GamesDB.laccdb index 5a03e0388674df9c401c0cef4dc38d6267f63454..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 GIT binary patch literal 0 HcmV?d00001 literal 64 icmZ>94fYQ45771WG4%0wG-gmh1CA-VnRytZ2t@#)Zwp2M 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); + } }