@Test
void shouldSetCustomCategoriesToResults() {

    final String categoryName = "Some category";
    Category category = new Category()
            .setName(categoryName)
            .setMessageRegex(".*")
            .setMatchedStatuses(singletonList(Status.BROKEN));
    Map<String, Object> meta = new HashMap<>();
    meta.put("categories", singletonList(category));
    final TestResult first = new TestResult()
            .setName("first")
            .setStatus(Status.FAILED)
            .setStatusMessage("B");
    final TestResult second = new TestResult()
            .setName("second")
            .setStatus(Status.BROKEN)
            .setStatusMessage("B");
    CategoriesPlugin.addCategoriesForResults(createSingleLaunchResults(meta, first, second));
    assertThat(first.getExtraBlock(CATEGORIES, new ArrayList<Category>()))
            .hasSize(1)
            .extracting(Category::getName)
            .containsExactlyInAnyOrder(FAILED_TESTS.getName());
    assertThat(second.getExtraBlock(CATEGORIES, new ArrayList<Category>()))
            .hasSize(1)
            .extracting(Category::getName)
            .containsExactlyInAnyOrder(categoryName);
}