45 lines
1.3 KiB
Java
45 lines
1.3 KiB
Java
package de.jeyp91.apifootball;
|
|
|
|
import org.junit.Test;
|
|
|
|
public class APIFootballUpdaterTest {
|
|
|
|
int season = 2025;
|
|
|
|
@Test
|
|
public void checkErrorsTest() {
|
|
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", rateLimitError);
|
|
} catch (Exception e) {
|
|
System.out.println(e.getMessage());
|
|
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(2025, 79);
|
|
}
|
|
|
|
@Test
|
|
public void updateAllFixturesTest() {
|
|
APIFootballUpdater updater = new APIFootballUpdater();
|
|
updater.updateAllFixtures(season);
|
|
}
|
|
|
|
@Test
|
|
public void updateRoundsTest() {
|
|
APIFootballUpdater updater = new APIFootballUpdater();
|
|
// updater.updateRounds(2777);
|
|
}
|
|
|
|
@Test
|
|
public void updateAllRoundsTest() {
|
|
APIFootballUpdater updater = new APIFootballUpdater();
|
|
updater.updateAllRounds(season);
|
|
}
|
|
}
|