Browse Source

Refactored Class and Test Class

dev
Adem Berber 3 years ago
parent
commit
576c24abcd
  1. 48
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 1
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

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

@ -57,8 +57,6 @@ public class Games {
break;
}
result += gameConsole + ", ";
}
@ -68,7 +66,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
@ -88,9 +86,8 @@ public class Games {
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa) && gamePublisherEu.equals(gamePublisherNa)) {
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa)
&& gamePublisherEu.equals(gamePublisherNa)) {
result += gameName + ", ";
}
@ -101,7 +98,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
@ -121,9 +118,8 @@ public class Games {
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (!gamePublisherEu.equals(gamePublisherJp) && !gamePublisherJp.equals(gamePublisherNa) && !gamePublisherEu.equals(gamePublisherNa)) {
if (!gamePublisherEu.equals(gamePublisherJp) && !gamePublisherJp.equals(gamePublisherNa)
&& !gamePublisherEu.equals(gamePublisherNa)) {
result += gameName + ", ";
}
@ -134,7 +130,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
@ -155,9 +151,9 @@ public class Games {
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa) && gamePublisherEu.equals(gamePublisherNa) && gameDeveloper.equals(gamePublisherEu) && gameDeveloper.equals(gamePublisherJp) && gameDeveloper.equals(gamePublisherNa) ) {
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa)
&& gamePublisherEu.equals(gamePublisherNa) && gameDeveloper.equals(gamePublisherEu)
&& gameDeveloper.equals(gamePublisherJp) && gameDeveloper.equals(gamePublisherNa)) {
result += gameName + ", ";
}
@ -168,7 +164,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
@ -189,18 +185,19 @@ public class Games {
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa) && gameReleaseEu.equals(gameReleaseNa)) {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa)
&& gameReleaseEu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
} else {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa) && gameReleaseEu.equals(gameReleaseNa) && gameReleaseAu.equals(gameReleaseEu) && gameReleaseAu.equals(gameReleaseJp) && gameReleaseAu.equals(gameReleaseNa) ) {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa)
&& gameReleaseEu.equals(gameReleaseNa) && gameReleaseAu.equals(gameReleaseEu)
&& gameReleaseAu.equals(gameReleaseJp) && gameReleaseAu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
@ -208,7 +205,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
@ -229,18 +226,19 @@ public class Games {
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa) && !gameReleaseEu.equals(gameReleaseNa)) {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa)
&& !gameReleaseEu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
} else {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa) && !gameReleaseEu.equals(gameReleaseNa) && !gameReleaseAu.equals(gameReleaseEu) && !gameReleaseAu.equals(gameReleaseJp) && !gameReleaseAu.equals(gameReleaseNa) ) {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa)
&& !gameReleaseEu.equals(gameReleaseNa) && !gameReleaseAu.equals(gameReleaseEu)
&& !gameReleaseAu.equals(gameReleaseJp) && !gameReleaseAu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
@ -248,7 +246,7 @@ public class Games {
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 2);
}
}

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

@ -1,4 +1,5 @@
package de.hs_fulda.ciip.projjpn;
import junit.framework.TestCase;
public class GamesTest extends TestCase {

Loading…
Cancel
Save