Browse Source

Added Atlus Developer Checker + Test

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

BIN
projjpn/GamesDB.laccdb

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

@ -508,4 +508,34 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkDeveloperAtlus() {
String result = "";
String query = "SELECT Game_Name, Game_Developer 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 gameDeveloper = resultSet.getString("Game_Developer");
if (gameDeveloper.equals("Atlus")) {
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

@ -107,4 +107,11 @@ public class GamesTest extends TestCase {
String actual = testObject.checkConsoleNintendoSwitch();
assertEquals(expected, actual);
}
public void test_checkDeveloperAtlus() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Persona 3 Portable";
String actual = testObject.checkDeveloperAtlus();
assertEquals(expected, actual);
}
}
Loading…
Cancel
Save