use of no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class CurrentGameTest method testCurrentGame.
@Test
public void testCurrentGame() {
final L4J8 l4j8 = new L4J8(SecretFile.CREDS);
SpectatorBuilder sb = new SpectatorBuilder().withPlatform(Platform.EUW1);
// Get a game in progess
final List<SpectatorGameInfo> game = sb.getFeaturedGames();
// Get a summoner from that game
final String name = game.get(0).getParticipants().get(0).getSummonerName();
final Summoner sum = new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[0]).withName(name).get();
// Get game info
final SpectatorGameInfo currentGame = sb.withSummonerId(sum.getSummonerId()).getCurrentGame();
if (currentGame != null) {
doAssertions.accept(currentGame);
}
}
use of no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class SummonerTest method testById.
@Test
public void testById() {
for (int i = 0; i < Constants.TEST_SUMMONER_IDS.length; i++) {
Summoner optional = new SummonerBuilder().withPlatform(Constants.TEST_PLATFORM[i]).withSummonerId(Constants.TEST_SUMMONER_IDS[i]).get();
doAssertions.accept(optional);
}
}
use of no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder in project L4J8 by stelar7.
the class AsyncTest method testAsync.
@Test
@Ignore
public void testAsync() {
List<CompletableFuture> futures = new ArrayList<>();
for (int i = 0; i < 100; i++) {
futures.add(supplyAsync(() -> new SummonerBuilder().withPlatform(Platform.EUW1).withAccountId(Constants.TEST_ACCOUNT_IDS[1]).get()).thenAccept(this::handleSummonerCallback));
}
futures.add(supplyAsync(() -> new MatchListBuilder().withPlatform(Platform.EUW1).withAccountId(Constants.TEST_ACCOUNT_IDS[1]).get()).thenAccept(this::handleMatchCallback));
CompletableFuture spinner = CompletableFuture.allOf(futures.toArray(new CompletableFuture[futures.size()]));
spinner.join();
}
Aggregations