-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d496b0d
commit 4037e9d
Showing
24 changed files
with
1,261 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
sdk-core/src/test/java/com/sportradar/unifiedodds/sdk/ErrorHandlingStrategiesTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code | ||
*/ | ||
package com.sportradar.unifiedodds.sdk; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.util.List; | ||
import java.util.stream.Collectors; | ||
import java.util.stream.Stream; | ||
import org.junit.Test; | ||
|
||
public class ErrorHandlingStrategiesTest { | ||
|
||
private final int sampleSize = 100; | ||
private List<ExceptionHandlingStrategy> strategies = Stream | ||
.generate(() -> ExceptionHandlingStrategies.anyErrorHandlingStrategy()) | ||
.limit(sampleSize) | ||
.distinct() | ||
.collect(Collectors.toList()); | ||
|
||
@Test | ||
public void anyStrategyGeneratesNotAlwaysTheSameStrategy() { | ||
assertThat(strategies).hasSizeGreaterThan(1); | ||
} | ||
|
||
@Test | ||
public void anyStrategyDoesNotGenerateNulls() { | ||
assertThat(strategies).doesNotContainNull(); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
sdk-core/src/test/java/com/sportradar/unifiedodds/sdk/ExceptionHandlingStrategies.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code | ||
*/ | ||
package com.sportradar.unifiedodds.sdk; | ||
|
||
import static com.sportradar.unifiedodds.sdk.ExceptionHandlingStrategy.Catch; | ||
import static com.sportradar.unifiedodds.sdk.ExceptionHandlingStrategy.Throw; | ||
|
||
import java.util.Arrays; | ||
import java.util.Random; | ||
import lombok.val; | ||
|
||
public class ExceptionHandlingStrategies { | ||
|
||
private static Random random = new Random(); | ||
|
||
private ExceptionHandlingStrategies() {} | ||
|
||
public static ExceptionHandlingStrategy anyErrorHandlingStrategy() { | ||
val strategiesPool = Arrays.asList(Throw, Catch); | ||
return strategiesPool.get(random.nextInt(strategiesPool.size())); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
sdk-core/src/test/java/com/sportradar/unifiedodds/sdk/caching/impl/DataRouterManagers.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code | ||
*/ | ||
package com.sportradar.unifiedodds.sdk.caching.impl; | ||
|
||
import com.sportradar.unifiedodds.sdk.caching.DataRouterManager; | ||
|
||
public class DataRouterManagers { | ||
|
||
private DataRouterManagers() {} | ||
|
||
public static DataRouterManager any() { | ||
return new NoOpDataRouterManager(); | ||
} | ||
} |
147 changes: 147 additions & 0 deletions
147
...core/src/test/java/com/sportradar/unifiedodds/sdk/caching/impl/NoOpDataRouterManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
/* | ||
* Copyright (C) Sportradar AG. See LICENSE for full license governing this code | ||
*/ | ||
package com.sportradar.unifiedodds.sdk.caching.impl; | ||
|
||
import com.sportradar.uf.sportsapi.datamodel.SAPIMatchTimelineEndpoint; | ||
import com.sportradar.unifiedodds.sdk.caching.CacheItem; | ||
import com.sportradar.unifiedodds.sdk.caching.DataRouterManager; | ||
import com.sportradar.unifiedodds.sdk.custombetentities.AvailableSelections; | ||
import com.sportradar.unifiedodds.sdk.custombetentities.Calculation; | ||
import com.sportradar.unifiedodds.sdk.custombetentities.CalculationFilter; | ||
import com.sportradar.unifiedodds.sdk.custombetentities.Selection; | ||
import com.sportradar.unifiedodds.sdk.entities.FixtureChange; | ||
import com.sportradar.unifiedodds.sdk.entities.PeriodStatus; | ||
import com.sportradar.unifiedodds.sdk.entities.ResultChange; | ||
import com.sportradar.unifiedodds.sdk.exceptions.internal.CommunicationException; | ||
import com.sportradar.utils.URN; | ||
import java.util.Date; | ||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
public class NoOpDataRouterManager implements DataRouterManager { | ||
|
||
@Override | ||
public void requestSummaryEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestFixtureEndpoint(Locale locale, URN id, boolean useCachedProvider, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestDrawSummary(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestDrawFixture(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestAllTournamentsForAllSportsEndpoint(Locale locale) throws CommunicationException {} | ||
|
||
@Override | ||
public void requestAllSportsEndpoint(Locale locale) throws CommunicationException {} | ||
|
||
@Override | ||
public List<URN> requestAllLotteriesEndpoint(Locale locale, Boolean requireResult) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<URN> requestEventsFor(Locale locale, URN tournamentId) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<URN> requestEventsFor(Locale locale, Date date) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<URN> requestLotterySchedule(Locale locale, URN lotteryId, CacheItem requester) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void requestPlayerProfileEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestCompetitorEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public void requestSimpleTeamEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public List<URN> requestSeasonsFor(Locale locale, URN tournamentId) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public SAPIMatchTimelineEndpoint requestEventTimelineEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void requestSportCategoriesEndpoint(Locale locale, URN id, CacheItem requester) | ||
throws CommunicationException {} | ||
|
||
@Override | ||
public AvailableSelections requestAvailableSelections(URN id) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Calculation requestCalculateProbability(List<Selection> selections) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public CalculationFilter requestCalculateProbabilityFilter(List<Selection> selections) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<FixtureChange> requestFixtureChanges(Date after, URN sportId, Locale locale) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<ResultChange> requestResultChanges(Date after, URN sportId, Locale locale) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<URN> requestListSportEvents(Locale locale, int startIndex, int limit) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<URN> requestAvailableTournamentsFor(Locale locale, URN sportId) | ||
throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public List<PeriodStatus> requestPeriodSummary( | ||
URN id, | ||
Locale locale, | ||
List<URN> competitorIds, | ||
List<Integer> periods | ||
) throws CommunicationException { | ||
return null; | ||
} | ||
|
||
@Override | ||
public void close() {} | ||
} |
Oops, something went wrong.