Refactor API Football to v3

This commit is contained in:
2025-01-26 22:03:10 +01:00
parent bed7c64189
commit baffe58204
24 changed files with 1719 additions and 242 deletions

View File

@@ -1,5 +1,6 @@
package de.jeyp91;
import org.json.simple.JSONObject;
import org.junit.Test;
public class S3ProviderTest {
@@ -7,7 +8,7 @@ public class S3ProviderTest {
@Test
public void getFixturesFromS3Test() {
S3Provider prov = new S3Provider();
String rounds = prov.getFixturesStringFromS3(1240);
System.out.println(rounds);
JSONObject rounds = prov.getFixturesJSONFromS3(2025, 1240);
System.out.println(rounds.toJSONString());
}
}

View File

@@ -8,20 +8,20 @@ public class APIFootballUpdaterTest {
@Test
public void checkErrorsTest() {
String exceededLimitDayError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}";
String rateLimitError = "{\"results\":0,\"errors\":{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}}";
APIFootballUpdater updater = new APIFootballUpdater();
try {
updater.checkErrors("https://test.url/api", exceededLimitDayError);
updater.checkErrors("https://test.url/api", rateLimitError);
} catch (Exception e) {
System.out.println(e.getMessage());
assert e.getMessage().equals("https://test.url/api returned error: 'You have reached the request limit for the day'");
assert e.getMessage().equals("https://test.url/api returned error: '{\"rateLimit\":\"Too many requests. Your rate limit is 10 requests per minute.\"}'");
}
}
@Test
public void updateFixturesTest() {
APIFootballUpdater updater = new APIFootballUpdater();
// updater.updateFixtures(1240);
updater.updateFixtures(2025, 79);
}
@Test

View File

@@ -2,10 +2,6 @@ package de.jeyp91.tippliga;
import org.junit.Test;
import java.text.ParseException;
import static org.junit.Assert.assertEquals;
public class TLWMatchesCreatorTipperTest {
int season = 2025;

View File

@@ -1,11 +1,8 @@
package de.jeyp91.tippliga;
import org.junit.Test;
import java.text.ParseException;
import java.util.ArrayList;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class TLWTeamsCreatorTest {

View File

@@ -1,41 +1,40 @@
package de.jeyp91.tippligaforum;
import de.jeyp91.tippligaforum.MatchesListCreator;
import org.junit.Test;
public class MatchesListCreatorTest {
@Test
public void getMatchesTest2664() {
MatchesListCreator creator = new MatchesListCreator(2664);
MatchesListCreator creator = new MatchesListCreator(2025, 2664);
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2743() {
MatchesListCreator creator = new MatchesListCreator(2743);
MatchesListCreator creator = new MatchesListCreator(2025, 2743);
String matches = creator.getMatchesBeautiful();
System.out.println(matches);
}
@Test
public void getMatchesTest2755() {
MatchesListCreator creator = new MatchesListCreator(2755);
MatchesListCreator creator = new MatchesListCreator(2025, 2755);
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2790() {
MatchesListCreator creator = new MatchesListCreator(2790);
MatchesListCreator creator = new MatchesListCreator(2025, 2790);
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}
@Test
public void getMatchesTest2795() {
MatchesListCreator creator = new MatchesListCreator(2795);
MatchesListCreator creator = new MatchesListCreator(2025, 2795);
String matches = creator.getMatchesBeautiful();
// System.out.println(matches);
}