use of pokeraidbot.domain.config.LocaleService in project pokeraidbot by magnusmickelsson.
the class GymRepositoryTest method setUp.
@Before
public void setUp() throws Exception {
UserConfigRepository userConfigRepository = mock(UserConfigRepository.class);
when(userConfigRepository.findOne(any(String.class))).thenReturn(null);
localeService = new LocaleService("sv", userConfigRepository);
final Config dalarnaConfig = new Config("dalarna", "dalarna");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("dalarna")).thenReturn(dalarnaConfig);
final Config uppsalaConfig = new Config("uppsala", "uppsala");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("uppsala")).thenReturn(uppsalaConfig);
final Config angelholmConfig = new Config("ängelholm", "ängelholm");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("ängelholm")).thenReturn(angelholmConfig);
final Config luleConfig = new Config("luleå", "luleå");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("luleå")).thenReturn(luleConfig);
final Config umeConfig = new Config("umeå", "umeå");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("umeå")).thenReturn(umeConfig);
final Config vannasConfig = new Config("vännäs", "vännäs");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("vännäs")).thenReturn(vannasConfig);
final Config lyckseleConfig = new Config("lycksele", "lycksele");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("lycksele")).thenReturn(lyckseleConfig);
final Config norrkopingConfig = new Config("norrköping", "norrköping");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("norrköping")).thenReturn(norrkopingConfig);
final Config trollhattanConfig = new Config("trollhättan", "trollhättan");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("trollhättan")).thenReturn(trollhattanConfig);
final Config helsingborgConfig = new Config("helsingborg", "helsingborg");
when(SERVER_CONFIG_REPOSITORY.getConfigForServer("helsingborg")).thenReturn(helsingborgConfig);
configMap = new HashMap<>();
configMap.put("dalarna", dalarnaConfig);
configMap.put("uppsala", uppsalaConfig);
configMap.put("ängelholm", angelholmConfig);
configMap.put("luleå", luleConfig);
configMap.put("umeå", umeConfig);
configMap.put("vännäs", vannasConfig);
configMap.put("norrköping", norrkopingConfig);
configMap.put("trollhättan", trollhattanConfig);
configMap.put("helsingborg", helsingborgConfig);
configMap.put("lycksele", lyckseleConfig);
when(SERVER_CONFIG_REPOSITORY.getAllConfig()).thenReturn(configMap);
repo = TestServerMain.getGymRepositoryForConfig(localeService, SERVER_CONFIG_REPOSITORY);
}
use of pokeraidbot.domain.config.LocaleService in project pokeraidbot by magnusmickelsson.
the class CounterTextFileParserText method setUp.
@Before
public void setUp() throws Exception {
UserConfigRepository userConfigRepository = Mockito.mock(UserConfigRepository.class);
when(userConfigRepository.findOne(any(String.class))).thenReturn(null);
localeService = new LocaleService("sv", userConfigRepository);
}
use of pokeraidbot.domain.config.LocaleService in project pokeraidbot by magnusmickelsson.
the class UtilsTest method testPrintWeaknesses.
@Test
public void testPrintWeaknesses() throws Exception {
PokemonRepository pokemonRepository = new PokemonRepository("/pokemons.csv", new LocaleService("sv", userConfigRepository));
Pokemon pokemon = pokemonRepository.search("Tyranitar", null);
assertThat(Utils.printWeaknesses(pokemon), is("Water, **Fighting**, Ground, Grass, Steel, Bug, Fairy"));
}
use of pokeraidbot.domain.config.LocaleService in project pokeraidbot by magnusmickelsson.
the class UtilsTest method timeInRaidspan.
@Test
public void timeInRaidspan() throws Exception {
User user = mock(User.class);
when(user.getName()).thenReturn("User");
LocalDateTime localDateTime = LocalDateTime.now();
LocalDateTime same = localDateTime;
LocalDateTime before = localDateTime.minusMinutes(1);
LocalDateTime after = localDateTime.plusMinutes(1);
LocalDateTime end = localDateTime.plusMinutes(Utils.RAID_DURATION_IN_MINUTES);
LocalDateTime sameAsEnd = end;
LocalDateTime beforeEnd = end.minusMinutes(1);
LocalDateTime afterEnd = end.plusMinutes(1);
final LocaleService localeService = mock(LocaleService.class);
when(localeService.getMessageFor(any(), any(), any())).thenReturn("Mupp");
Raid raid = new Raid(pokemonRepository.getByName("Tyranitar"), end, new Gym("Test", "id", "10", "10", null), localeService, "Test");
checkWhetherAssertFails(user, same, localeService, raid, false);
checkWhetherAssertFails(user, after, localeService, raid, false);
checkWhetherAssertFails(user, before, localeService, raid, true);
checkWhetherAssertFails(user, sameAsEnd, localeService, raid, false);
checkWhetherAssertFails(user, afterEnd, localeService, raid, true);
checkWhetherAssertFails(user, beforeEnd, localeService, raid, false);
}
use of pokeraidbot.domain.config.LocaleService in project pokeraidbot by magnusmickelsson.
the class UtilsTest method before.
@BeforeClass
public static void before() {
userConfigRepository = mock(UserConfigRepository.class);
when(userConfigRepository.findOne(any(String.class))).thenReturn(null);
localeService = new LocaleService("sv", userConfigRepository);
}
Aggregations