Browse Source

Added Javadoc to Misc Methods

dev
Adem Berber 3 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 {
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() {
try {
Connection connection = DriverManager.getConnection(databaseURL);
@ -20,7 +24,11 @@ public class Games {
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() {
String result = "";
String query = "SELECT * FROM Games";
@ -93,7 +101,7 @@ public class Games {
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 1);
}
public String checkGames() {
String result = "";
String query = "SELECT Game_Name FROM Games";
@ -1643,7 +1651,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkEsrbE() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1672,7 +1680,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkEsrbEten() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1701,7 +1709,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkEsrbT() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1730,7 +1738,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkEsrbM() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
@ -1759,7 +1767,7 @@ 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";
@ -1788,7 +1796,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkCeroB() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1817,7 +1825,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkCeroC() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1846,7 +1854,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkCeroD() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1875,7 +1883,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkCeroZ() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
@ -1904,7 +1912,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkAcbG() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1933,7 +1941,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkAcbPg() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1962,7 +1970,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkAcbM() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -1991,7 +1999,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkAcbMaFifteen() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
@ -2020,7 +2028,7 @@ public class Games {
return result.substring(0, result.length() - 2);
}
public String checkAcbReighteen() {
String result = "";
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();
assertEquals(expected, actual);
}
public void test_checkEsrbE() {
Games testObject = new Games();
String expected = "Rhythm Paradise, Tomodachi Life, Beautiful Katamari";
String actual = testObject.checkEsrbE();
assertEquals(expected, actual);
}
public void test_checkEsrbEten() {
Games testObject = new Games();
String expected = "Super Smash Bros. Ultimate, Crash Bandicoot N. Sane Trilogy";
String actual = testObject.checkEsrbEten();
assertEquals(expected, actual);
}
public void test_checkEsrbT() {
Games testObject = new Games();
String expected = "Ratchet & Clank, Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future, Atelier Totori Plus";
String actual = testObject.checkEsrbT();
assertEquals(expected, actual);
}
public void test_checkEsrbM() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable";
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);
}
public void test_checkAcbG() {
Games testObject = new Games();
String expected = "Rhythm Paradise, Beautiful Katamari";
String actual = testObject.checkAcbG();
assertEquals(expected, actual);
}
public void test_checkAcbPg() {
Games testObject = new Games();
String expected = "Ratchet & Clank, Super Smash Bros. Ultimate, Tomodachi Life, Crash Bandicoot N. Sane Trilogy";
String actual = testObject.checkAcbPg();
assertEquals(expected, actual);
}
public void test_checkAcbM() {
Games testObject = new Games();
String expected = "Astral Chain, Fire Emblem: Three Houses, Triangle Strategy, Jet Set Radio Future";
String actual = testObject.checkAcbM();
assertEquals(expected, actual);
}
public void test_checkAcbMaFifteen() {
Games testObject = new Games();
String expected = "Persona 5 Royal, Yakuza: Dead Souls, Breakdown, AI: The Somnium Files, Persona 3 Portable";
String actual = testObject.checkAcbMaFifteen();
assertEquals(expected, actual);
}
public void test_checkAcbReighteen() {
Games testObject = new Games();
String expected = "Atelier Totori Plus";

Loading…
Cancel
Save