Search in sources :

Example 1 with ScPuzzle

use of com.faendir.zachtronics.bot.sc.model.ScPuzzle in project zachtronics-leaderboard-bot by F43nd1r.

the class SolRepoFindTest method testFindCategoryHolders.

@Test
public void testFindCategoryHolders() {
    ScPuzzle puzzle = ScPuzzle.research_example_1;
    List<CategoryRecord<ScRecord, ScCategory>> categoryHolders = repository.findCategoryHolders(puzzle, false);
    assertEquals(2, categoryHolders.size());
    List<ScCategory> coveredCategories = categoryHolders.stream().map(CategoryRecord::getCategories).flatMap(Set::stream).sorted().toList();
    assertEquals(puzzle.getSupportedCategories(), coveredCategories);
}
Also used : Set(java.util.Set) ScPuzzle(com.faendir.zachtronics.bot.sc.model.ScPuzzle) CategoryRecord(com.faendir.zachtronics.bot.repository.CategoryRecord) ScCategory(com.faendir.zachtronics.bot.sc.model.ScCategory) Test(org.junit.jupiter.api.Test) BotTest(com.faendir.zachtronics.bot.BotTest)

Example 2 with ScPuzzle

use of com.faendir.zachtronics.bot.sc.model.ScPuzzle in project zachtronics-leaderboard-bot by F43nd1r.

the class ScShowCommand method findPuzzleAndCategory.

@NotNull
@Override
public Pair<ScPuzzle, ScCategory> findPuzzleAndCategory(@NotNull ShowData parameters) {
    ScPuzzle puzzle = parameters.puzzle;
    ScCategory category = parameters.category;
    if (!parameters.puzzle.getSupportedCategories().contains(category))
        throw new IllegalArgumentException("Category " + category.getDisplayName() + " does not support " + puzzle.getDisplayName());
    return new Pair<>(puzzle, category);
}
Also used : ScPuzzle(com.faendir.zachtronics.bot.sc.model.ScPuzzle) ScCategory(com.faendir.zachtronics.bot.sc.model.ScCategory) Pair(kotlin.Pair) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ScCategory (com.faendir.zachtronics.bot.sc.model.ScCategory)2 ScPuzzle (com.faendir.zachtronics.bot.sc.model.ScPuzzle)2 BotTest (com.faendir.zachtronics.bot.BotTest)1 CategoryRecord (com.faendir.zachtronics.bot.repository.CategoryRecord)1 Set (java.util.Set)1 Pair (kotlin.Pair)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.junit.jupiter.api.Test)1