### Question:
TopicTypeFilter implements PluginFilter { @SuppressWarnings("SimplifiableIfStatement") @Override public boolean accept(Plugin plugin) { if (!(plugin instanceof TopicPlugin)) { return false; } return Objects.equals(topicType, ((TopicPlugin) plugin).getTopicType()); } TopicTypeFilter(String topicType); @SuppressWarnings("SimplifiableIfStatement") @Override boolean accept(Plugin plugin);  }### Answer:
@Test public void filterShouldAcceptTopicPluginWithCorrectTopicType() throws Exception { TopicPlugin topicPlugin = getPluginWithTopicType("type"); TopicTypeFilter topicTypeFilter = new TopicTypeFilter("type"); assertTrue(topicTypeFilter.accept(topicPlugin)); }
@Test public void filterShouldRejectTopicPluginWithIncorrectTopicType() throws Exception { TopicPlugin topicPlugin = getPluginWithTopicType("type"); TopicTypeFilter topicTypeFilter = new TopicTypeFilter("type1"); assertFalse(topicTypeFilter.accept(topicPlugin)); }
@Test public void filterShouldRejectNotTopicPlugin() { Plugin plugin = mock(Plugin.class); TopicTypeFilter topicTypeFilter = new TopicTypeFilter("type"); assertFalse(topicTypeFilter.accept(plugin)); }
@Test public void filterShouldRejectTopicPlugin_IfTopicTypeCaseDoesNotMatch() { TopicPlugin topicPlugin = getPluginWithTopicType("type"); TopicTypeFilter topicTypeFilter = new TopicTypeFilter("Type"); assertFalse(topicTypeFilter.accept(topicPlugin)); }