Refactor and clean up code

This commit is contained in:
2020-09-27 23:26:41 +02:00
parent 283efc775b
commit a484010285
20 changed files with 349 additions and 373 deletions

View File

@@ -1,43 +0,0 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWFootballMatchdaysCreatorTest {
@Test
public void getMatchdaysWTLPokalTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "WTL_Pokal.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysWTLPokalSqlTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 98, "WTL_Pokal.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysTippligaTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "Tippliga.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysTippligaSqlTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 52, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,75 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWMatchdaysCreatorTest {
@Test
public void getMatchdaysTippligaTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysWTLPokalTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "WTL_Pokal.json");
ArrayList<TLWMatchday> matchdays = matchdaysCreator.getMatchdays();
assertEquals((Integer) 1, matchdays.get(0).getMatchday());
}
@Test
public void getMatchdaysTippliga1SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysTippliga2SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysTippliga51SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 51, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysTippliga52SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 52, "Tippliga.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysWTLPokal48SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
@Test
public void getMatchdaysWTLPokal98SqlTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 98, "WTL_Pokal.json");
String sql = matchdaysCreator.getMatchdaysSQL();
System.out.println(sql);
}
}

View File

@@ -6,11 +6,11 @@ import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWFootballMatchesCreatorTest {
public class TLWMatchesCreatorFootballTest {
@Test
public void getMatchesTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 1, "WTL_Pokal.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 1, "WTL_Pokal.json");
ArrayList<TLWMatch> matches = creator.getMatches();
assertEquals((Integer) 1, matches.get(0).getMatchNo());
@@ -20,14 +20,14 @@ public class TLWFootballMatchesCreatorTest {
@Test
public void getMatchesTippligaSqlTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 2, "Tippliga.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 2, "Tippliga.json");
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
@Test
public void getMatchesWTLPokalSqlTest() {
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 48, "WTL_Pokal.json");
TLWMatchesCreatorFootball creator = new TLWMatchesCreatorFootball(2021, 48, "WTL_Pokal.json");
String sql = creator.getSQLInsertString();
System.out.println(sql);
}

View File

@@ -0,0 +1,16 @@
package de.jeyp91.tippliga;
import org.junit.Test;
public class TLWMatchesCreatorTipperPokalTest {
@Test
public void getMatchesWTLPokalTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,18 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
public class TLWMatchesCreatorTipperTest {
@Test
public void getMatchesTippligaTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -0,0 +1,58 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWTeamsCreatorTest {
@Test
public void getTeamsTippligaFootball1Test() {
TLWMatchesCreatorFootball matchesCreator = new TLWMatchesCreatorFootball(2021, 1, "Tippliga.json");
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 1, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper1TLTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 1, "Tippliga.json");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 51, "1TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 51, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper2TLTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 2, "Tippliga.json");
TLWMatchesCreatorTipperLeague creator = new TLWMatchesCreatorTipperLeague(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 52, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipperWTLTest() {
TLWMatchdaysCreator matchdaysCreator = new TLWMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWMatchesCreatorTipperPokal creator = new TLWMatchesCreatorTipperPokal(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsCreator teamCreator = new TLWTeamsCreator(2021, 98, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
}

View File

@@ -1,58 +0,0 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWTeamsPokalCreatorTest {
@Test
public void getTeamsWTLPokalTest() {
TLWFootballMatchesCreator matchesCreator = new TLWFootballMatchesCreator(2021, 2, "Tippliga.json");
ArrayList<TLWMatch> matches = matchesCreator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 2, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper1TLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 1, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 51, "1TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 51, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipper2TLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 2, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 52, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
@Test
public void getTeamsTipperWTLTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWTipperPokalMatchesCreator creator = new TLWTipperPokalMatchesCreator(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
ArrayList<TLWMatch> matches = creator.getMatches();
TLWTeamsPokalCreator teamCreator = new TLWTeamsPokalCreator(2021, 98, matches);
String sql = teamCreator.getSql();
System.out.println(sql);
}
}

View File

@@ -1,20 +0,0 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
public class TLWTipperMatchesCreatorTest {
@Test
public void getMatchesTippligaTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 2, "Tippliga.json");
TLWTipperMatchesCreator creator = new TLWTipperMatchesCreator(2021, 52, "2TL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -1,16 +0,0 @@
package de.jeyp91.tippliga;
import org.junit.Test;
public class TLWTipperPokalMatchesCreatorTest {
@Test
public void getMatchesWTLPokalTest() {
TLWFootballMatchdaysCreator matchdaysCreator = new TLWFootballMatchdaysCreator(2021, 48, "WTL_Pokal.json");
TLWTipperPokalMatchesCreator creator = new TLWTipperPokalMatchesCreator(2021, 98, "WTL_Tipper.json", matchdaysCreator.getMatchdays());
String sql = creator.getSQLInsertString();
System.out.println(sql);
}
}

View File

@@ -1,8 +1,5 @@
package de.jeyp91.tippliga;
import de.jeyp91.tippliga.TLWMatch;
import de.jeyp91.tippliga.TLWTeam;
import de.jeyp91.tippliga.TippligaSQLConnector;
import org.junit.Before;
import org.junit.Test;
@@ -53,7 +50,7 @@ public class TippligaSQLConnectorTest {
@Test
public void getMatchesBySeasonAndLeague() {
ArrayList<TLWMatch> matches = tl.getMatchesBySeasonAndLeague("2020", "1");
ArrayList<TLWMatch> matches = tl.getMatches("2020", "1");
assertEquals(468, matches.size());