Add generic error handling for API Football
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user