Add generic error handling for API Football

This commit is contained in:
2021-01-10 20:38:11 +01:00
parent dd9c8cc0af
commit 87c0383db8
2 changed files with 37 additions and 21 deletions

View File

@@ -4,6 +4,18 @@ import org.junit.Test;
public class APIFootballUpdaterTest {
@Test
public void checkErrorsTest() {
String exceededLimitDayError = "{\"api\":{\"results\":0,\"error\":\"You have reached the request limit for the day\"}}";
APIFootballUpdater updater = new APIFootballUpdater();
try {
updater.checkErrors("https://test.url/api", exceededLimitDayError);
} 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'");
}
}
@Test
public void updateFixturesTest() throws Exception {
APIFootballUpdater updater = new APIFootballUpdater();