@@ -0,0 +1,2033 @@
+package org.ambraproject.wombat.service;%0A%0Aimport com.google.common.collect.ImmutableMap;%0Aimport org.ambraproject.wombat.model.SearchFilter;%0Aimport org.ambraproject.wombat.model.SearchFilterFactory;%0Aimport org.ambraproject.wombat.service.remote.ArticleSearchQuery;%0Aimport org.ambraproject.wombat.service.remote.SolrSearchApi;%0Aimport org.mockito.InjectMocks;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.testng.AbstractTestNGSpringContextTests;%0Aimport org.testng.annotations.BeforeMethod;%0Aimport org.testng.annotations.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.Map;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.ArgumentMatchers.any;%0Aimport static org.mockito.Mockito.mock;%0Aimport static org.mockito.Mockito.when;%0A%0A@ContextConfiguration(classes = %7BSearchFilterServiceTest.class%7D)%0Apublic class SearchFilterServiceTest extends AbstractTestNGSpringContextTests %7B%0A%0A  @Mock%0A  private SolrSearchApi solrSearchApi;%0A%0A  @Mock%0A  private SearchFilterFactory searchFilterFactory;%0A%0A  @InjectMocks%0A  private SearchFilterService searchFilterService;%0A%0A  @BeforeMethod%0A  public void initMocks() %7B%0A    MockitoAnnotations.initMocks(this);%0A  %7D%0A%0A  @Test%0A  public void testGetSearchFilters() throws IOException %7B%0A    SearchFilter mockFilter = mock(SearchFilter.class);%0A    when(searchFilterFactory.createSearchFilter(any(), any(),any())).thenReturn(mockFilter);%0A%0A    ArticleSearchQuery query = ArticleSearchQuery.builder()%0A        .setQuery(%22blah%22)%0A        .setSimple(true)%0A        .setIsCsvSearch(false).build();%0A%0A    ImmutableMap%3CString, SearchFilter%3E expected = ImmutableMap.of(%0A        %22subject_area%22, mockFilter,%0A        %22journal%22, mockFilter,%0A        %22article_type%22, mockFilter,%0A        %22author%22, mockFilter,%0A        %22section%22, mockFilter);%0A%0A    Map%3CString, SearchFilter%3E searchFilters = searchFilterService.getSearchFilters(query, null, null);%0A    assertEquals(expected, searchFilters);%0A  %7D%0A%0A%7D

test SearchFilterService