3 Commits

  1. 145
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 35
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

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

@ -1759,4 +1759,149 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkCeroA() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating 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 gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("A")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkCeroB() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating 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 gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("B")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkCeroC() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating 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 gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("C")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkCeroD() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating 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 gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("D")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
public String checkCeroZ() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating 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 gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("Z")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
}

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

@ -331,4 +331,39 @@ public class GamesTest extends TestCase {
String actual = testObject.checkEsrbM();
assertEquals(expected, actual);
}
public void test_checkCeroA() {
Games testObject = new Games();
String expected = "Ratchet & Clank, Rhythm Paradise, Super Smash Bros. Ultimate, Jet Set Radio Future, Tomodachi Life, Beautiful Katamari, Crash Bandicoot N. Sane Trilogy";
String actual = testObject.checkCeroA();
assertEquals(expected, actual);
}
public void test_checkCeroB() {
Games testObject = new Games();
String expected = "Fire Emblem: Three Houses, Persona 3 Portable, Atelier Totori Plus";
String actual = testObject.checkCeroB();
assertEquals(expected, actual);
}
public void test_checkCeroC() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Astral Chain, Triangle Strategy, Breakdown";
String actual = testObject.checkCeroC();
assertEquals(expected, actual);
}
public void test_checkCeroD() {
Games testObject = new Games();
String expected = "Yakuza: Dead Souls";
String actual = testObject.checkCeroD();
assertEquals(expected, actual);
}
public void test_checkCeroZ() {
Games testObject = new Games();
String expected = "AI: The Somnium Files";
String actual = testObject.checkCeroZ();
assertEquals(expected, actual);
}
}
Loading…
Cancel
Save