Browse Source

Added Nintendo Switch Console Checker + Test

dev
Adem Berber 3 years ago
parent
commit
9236d77c54
  1. BIN
      projjpn/GamesDB.accdb
  2. BIN
      projjpn/GamesDB.laccdb
  3. 30
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  4. 7
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

BIN
projjpn/GamesDB.accdb

BIN
projjpn/GamesDB.laccdb

30
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); 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);
}
} }

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

@ -100,4 +100,11 @@ public class GamesTest extends TestCase {
String actual = testObject.checkConsoleMultiplatform(); String actual = testObject.checkConsoleMultiplatform();
assertEquals(expected, actual); 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);
}
} }
Loading…
Cancel
Save