Browse Source

Added Javadoc to Misc Methods

dev
Adem Berber 2 years ago
parent
commit
7b305d29e9
  1. 42
      projjpn/src/main/java/de/hs_fulda/ciip/projjpn/Games.java
  2. 28
      projjpn/src/test/java/de/hs_fulda/ciip/projjpn/GamesTest.java

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

@ -8,7 +8,11 @@ import java.sql.Statement;
public class Games { public class Games {
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb"; private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb";
/**
* Checks if the connection to the database can be established
* @return Returns true if it connects successfully and false if the connection fails.
*/
public boolean checkConnection() { public boolean checkConnection() {
try { try {
Connection connection = DriverManager.getConnection(databaseURL); Connection connection = DriverManager.getConnection(databaseURL);
@ -20,7 +24,11 @@ public class Games {
return false; return false;
} }
} }
/**
* Prints the whole table for those, who cannot access the Database for some reason.
* @return Returns a String of the whole table.
*/
public String printTable() { public String printTable() {
String result = ""; String result = "";
String query = "SELECT * FROM Games"; String query = "SELECT * FROM Games";
@ -93,7 +101,7 @@ public class Games {
// The substring removes the last New line in the String. // The substring removes the last New line in the String.
return result.substring(0, result.length() - 1); return result.substring(0, result.length() - 1);
} }
public String checkGames() { public String checkGames() {
String result = ""; String result = "";
String query = "SELECT Game_Name FROM Games"; String query = "SELECT Game_Name FROM Games";
@ -1643,7 +1651,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkEsrbE() { public String checkEsrbE() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1672,7 +1680,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkEsrbEten() { public String checkEsrbEten() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1701,7 +1709,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkEsrbT() { public String checkEsrbT() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1730,7 +1738,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkEsrbM() { public String checkEsrbM() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1759,7 +1767,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkCeroA() { public String checkCeroA() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1788,7 +1796,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkCeroB() { public String checkCeroB() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1817,7 +1825,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkCeroC() { public String checkCeroC() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1846,7 +1854,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkCeroD() { public String checkCeroD() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1875,7 +1883,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkCeroZ() { public String checkCeroZ() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games"; String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1904,7 +1912,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbG() { public String checkAcbG() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1933,7 +1941,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbPg() { public String checkAcbPg() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1962,7 +1970,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbM() { public String checkAcbM() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1991,7 +1999,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbMaFifteen() { public String checkAcbMaFifteen() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -2020,7 +2028,7 @@ public class Games {
return result.substring(0, result.length() - 2); return result.substring(0, result.length() - 2);
} }
public String checkAcbReighteen() { public String checkAcbReighteen() {
String result = ""; String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games"; String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";

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

@ -303,98 +303,98 @@ public class GamesTest extends TestCase {
String actual = testObject.checkPegiUnknown(); String actual = testObject.checkPegiUnknown();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkEsrbE() { public void test_checkEsrbE() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Rhythm Paradise, Tomodachi Life, Beautiful Katamari"; String expected = "Rhythm Paradise, Tomodachi Life, Beautiful Katamari";
String actual = testObject.checkEsrbE(); String actual = testObject.checkEsrbE();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkEsrbEten() { public void test_checkEsrbEten() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Super Smash Bros. Ultimate, Crash Bandicoot N. Sane Trilogy"; String expected = "Super Smash Bros. Ultimate, Crash Bandicoot N. Sane Trilogy";
String actual = testObject.checkEsrbEten(); String actual = testObject.checkEsrbEten();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkEsrbT() { public void test_checkEsrbT() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Ratchet & Clank, Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future, Atelier Totori Plus"; String expected = "Ratchet & Clank, Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future, Atelier Totori Plus";
String actual = testObject.checkEsrbT(); String actual = testObject.checkEsrbT();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkEsrbM() { public void test_checkEsrbM() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable"; String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable";
String actual = testObject.checkEsrbM(); String actual = testObject.checkEsrbM();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkCeroA() { public void test_checkCeroA() {
Games testObject = new Games(); 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 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(); String actual = testObject.checkCeroA();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkCeroB() { public void test_checkCeroB() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Fire Emblem: Three Houses, Persona 3 Portable, Atelier Totori Plus"; String expected = "Fire Emblem: Three Houses, Persona 3 Portable, Atelier Totori Plus";
String actual = testObject.checkCeroB(); String actual = testObject.checkCeroB();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkCeroC() { public void test_checkCeroC() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Persona 5 Royal, Astral Chain, Triangle Strategy, Breakdown"; String expected = "Persona 5 Royal, Astral Chain, Triangle Strategy, Breakdown";
String actual = testObject.checkCeroC(); String actual = testObject.checkCeroC();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkCeroD() { public void test_checkCeroD() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Yakuza: Dead Souls"; String expected = "Yakuza: Dead Souls";
String actual = testObject.checkCeroD(); String actual = testObject.checkCeroD();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkCeroZ() { public void test_checkCeroZ() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "AI: The Somnium Files"; String expected = "AI: The Somnium Files";
String actual = testObject.checkCeroZ(); String actual = testObject.checkCeroZ();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbG() { public void test_checkAcbG() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Rhythm Paradise, Beautiful Katamari"; String expected = "Rhythm Paradise, Beautiful Katamari";
String actual = testObject.checkAcbG(); String actual = testObject.checkAcbG();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbPg() { public void test_checkAcbPg() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Ratchet & Clank, Super Smash Bros. Ultimate, Tomodachi Life, Crash Bandicoot N. Sane Trilogy"; String expected = "Ratchet & Clank, Super Smash Bros. Ultimate, Tomodachi Life, Crash Bandicoot N. Sane Trilogy";
String actual = testObject.checkAcbPg(); String actual = testObject.checkAcbPg();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbM() { public void test_checkAcbM() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future"; String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future";
String actual = testObject.checkAcbM(); String actual = testObject.checkAcbM();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbMaFifteen() { public void test_checkAcbMaFifteen() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable"; String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable";
String actual = testObject.checkAcbMaFifteen(); String actual = testObject.checkAcbMaFifteen();
assertEquals(expected, actual); assertEquals(expected, actual);
} }
public void test_checkAcbReighteen() { public void test_checkAcbReighteen() {
Games testObject = new Games(); Games testObject = new Games();
String expected = "Atelier Totori Plus"; String expected = "Atelier Totori Plus";

Loading…
Cancel
Save