First version with ability to create database for new season
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package de.jeyp91.tippliga;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TLWFootballMatchesCreatorTest {
|
||||
|
||||
@Test
|
||||
public void getMatchesTest() {
|
||||
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(2021, 1, "WTL_Pokal.json");
|
||||
ArrayList<TLWMatch> matches = creator.getMatches();
|
||||
|
||||
assertEquals((Integer) 1, matches.get(0).getMatchNo());
|
||||
assertEquals((Integer) 11, matches.get(10).getMatchNo());
|
||||
System.out.println(matches.get(0).getSQLQueryReplace());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMatchesTippligaSqlTest() {
|
||||
TLWFootballMatchesCreator creator = new TLWFootballMatchesCreator(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");
|
||||
String sql = creator.getSQLInsertString();
|
||||
System.out.println(sql);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class TippligaSQLConnectorTest {
|
||||
|
||||
TippligaSQLConnector tl;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
tl = new TippligaSQLConnector();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTeamsBySeasonAndLeagueTest() {
|
||||
ArrayList<TLWTeam> teams = tl.getTeamsBySeasonAndLeague("2020", "1");
|
||||
|
||||
assertEquals(84, teams.size());
|
||||
|
||||
assertEquals(2020, teams.get(0).getSeason());
|
||||
assertEquals(1, teams.get(0).getLeague());
|
||||
assertEquals(1, teams.get(0).getTeamId());
|
||||
assertEquals("Bayern München", teams.get(0).getTeamName());
|
||||
assertEquals("Bayern", teams.get(0).getTeamNameShort());
|
||||
assertEquals("FC Bayern Muenchen.png", teams.get(0).getTeamSymbol());
|
||||
assertEquals("", teams.get(0).getGroupId());
|
||||
assertEquals(0, teams.get(0).getMatchday());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getTeamsByIdTest() {
|
||||
ArrayList<TLWTeam> teams = tl.getTeamsById("1");
|
||||
|
||||
assertEquals(39, teams.size());
|
||||
|
||||
assertEquals(2011, teams.get(0).getSeason());
|
||||
assertEquals(1, teams.get(0).getLeague());
|
||||
assertEquals(1, teams.get(0).getTeamId());
|
||||
assertEquals("Bayern München", teams.get(0).getTeamName());
|
||||
assertEquals("Bayern", teams.get(0).getTeamNameShort());
|
||||
assertEquals("FC Bayern Muenchen.png", teams.get(0).getTeamSymbol());
|
||||
assertEquals("", teams.get(0).getGroupId());
|
||||
assertEquals(0, teams.get(0).getMatchday());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getMatchesBySeasonAndLeague() {
|
||||
ArrayList<TLWMatch> matches = tl.getMatchesBySeasonAndLeague("2020", "1");
|
||||
|
||||
assertEquals(468, matches.size());
|
||||
|
||||
assertEquals((Integer) 2020, matches.get(0).getSeason());
|
||||
assertEquals((Integer) 1, matches.get(0).getLeague());
|
||||
assertEquals((Integer) 1, matches.get(0).getMatchday());
|
||||
assertEquals("", matches.get(0).getGroupId());
|
||||
assertEquals((Integer) 1, matches.get(0).getMatchNo());
|
||||
assertEquals("2019-07-26 20:30:00", matches.get(0).getMatchDateTime());
|
||||
assertEquals((Integer) 8, matches.get(0).getTeamIdHome());
|
||||
assertEquals((Integer) 15, matches.get(0).getTeamIdGuest());
|
||||
assertEquals((Integer) 2, matches.get(0).getGoalsHome());
|
||||
assertEquals((Integer) 1, matches.get(0).getGoalsGuest());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user