Search in sources :

Example 1 with SpectatorGameInfo

use of no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo in project L4J8 by stelar7.

the class FeaturedGameTest method testCurrentGame.

@Test
public void testCurrentGame() {
    final L4J8 l4j8 = new L4J8(SecretFile.CREDS);
    SpectatorBuilder sb = new SpectatorBuilder().withPlatform(Platform.EUW1);
    final List<SpectatorGameInfo> game = sb.getFeaturedGames();
    doAssertions.accept(game);
}
Also used : SpectatorGameInfo(no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo) L4J8(no.stelar7.api.l4j8.impl.L4J8) SpectatorBuilder(no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)

Example 2 with SpectatorGameInfo

use of no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo 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);
    }
}
Also used : Summoner(no.stelar7.api.l4j8.pojo.summoner.Summoner) SpectatorGameInfo(no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo) L4J8(no.stelar7.api.l4j8.impl.L4J8) SummonerBuilder(no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder) SpectatorBuilder(no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)

Example 3 with SpectatorGameInfo

use of no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo in project L4J8 by stelar7.

the class CurrentGameTest method testCurrentlyNotInGame.

@Test
public void testCurrentlyNotInGame() {
    final L4J8 l4j8 = new L4J8(SecretFile.CREDS);
    SpectatorBuilder sb = new SpectatorBuilder().withPlatform(Constants.TEST_PLATFORM[0]).withSummonerId(Constants.TEST_SUMMONER_IDS[0]);
    SpectatorGameInfo game = sb.getCurrentGame();
    System.out.format("%s is %sin game%n", Constants.TEST_SUMMONER_NAMES[0], game != null ? "" : "not ");
}
Also used : SpectatorGameInfo(no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo) L4J8(no.stelar7.api.l4j8.impl.L4J8) SpectatorBuilder(no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)

Aggregations

L4J8 (no.stelar7.api.l4j8.impl.L4J8)3 SpectatorBuilder (no.stelar7.api.l4j8.impl.builders.spectator.SpectatorBuilder)3 SpectatorGameInfo (no.stelar7.api.l4j8.pojo.spectator.SpectatorGameInfo)3 SummonerBuilder (no.stelar7.api.l4j8.impl.builders.summoner.SummonerBuilder)1 Summoner (no.stelar7.api.l4j8.pojo.summoner.Summoner)1