// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/model/ServiceResponse.java
// public class ServiceResponse<T> implements Serializable{
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 8231671973667011469L;
// 
//     public enum Status {
//         OK, NOT_FOUND, CACHE_KEY_MISS, ILLEGAL_MODIFICATION, NON_CONFORMANT
//     }
// 
//     private final Status status;
//     private final transient T obj;
// 
//     public ServiceResponse(Status status, T obj) {
//         this.status = status;
//         this.obj = obj;
//     }
// 
//     public Status getStatus() {
//         return status;
//     }
// 
//     public T getObj() {
//         return obj;
//     }
// }
// 
// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/model/annotation/page/PageParameters.java
// public class PageParameters {
// 
//     private int total;
// 
//     private String firstPageNumber;
//     private String lastPageNumber;
//     private String nextPageNumber;
//     private int nextPage = 0;
//     private int lastPage = 0;
//     private String previousPageNumber;
//     private String startIndexString;
// 
//     private int startIndex;
// 
//     public int getTotal() {
// 	return total;
//     }
//     public void setTotal(int total) {
// 	this.total = total;
//     }
// 
//     public String getFirstPageNumber() {
// 	return firstPageNumber;
//     }
//     public void setFirstPageNumber(String firstPageNumber) {
// 	this.firstPageNumber = firstPageNumber;
//     }
//     public String getLastPageNumber() {
// 	return lastPageNumber;
//     }
//     public void setLastPageNumber(String lastPageNumber) {
// 	this.lastPageNumber = lastPageNumber;
//     }
//     public String getNextPageNumber() {
// 	return nextPageNumber;
//     }
//     public void setNextPageNumber(String nextPageNumber) {
// 	this.nextPageNumber = nextPageNumber;
//     }
//     public String getPreviousPageNumber() {
// 	return previousPageNumber;
//     }
//     public void setPreviousPageNumber(String previousPageNumber) {
// 	this.previousPageNumber = previousPageNumber;
//     }
//     public int getStartIndex() {
// 	return startIndex;
//     }
//     public void setStartIndex(int startIndex) {
// 	this.startIndex = startIndex;
//     }
//     public int getNextPage() {
// 	return nextPage;
//     }
//     public void setNextPage(int nextPage) {
// 	this.nextPage = nextPage;
//     }
//     public int getLastPage() {
// 	return lastPage;
//     }
//     public void setLastPage(int lastPage) {
// 	this.lastPage = lastPage;
//     }
//     public String getStartIndexString() {
// 	return startIndexString;
//     }
//     public void setStartIndexString(String startIndexString) {
// 	this.startIndexString = startIndexString;
//     }
// 
// 
//     @Override
//     public String toString(){
// 	return "total:" +this.getTotal() + " startIndex:" +this.getStartIndex() + " nextPage:" + this.getNextPage() ;
//     }
// 
// }
// 
// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/service/TextSearchService.java
// public interface TextSearchService {
// 
// 
// 
//    public ServiceResponse<Map<String, Object>> getTextPositions(String query, String queryString, boolean isW3c, String page, boolean isMixedSearch, String within, String widthHeight);
// 
// 
//     public long getTotalHits();
// 
//     public PageParameters getPageParameters();
// 
//     public TextUtils getTextUtils();
// 
// }


import static org.junit.Assert.*;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import com.digirati.themathmos.model.ServiceResponse;
import com.digirati.themathmos.model.annotation.page.PageParameters;
import com.digirati.themathmos.service.TextSearchService;
import com.google.common.collect.Iterators;
package com.digirati.themathmos.service.impl;





public class OASearchServiceImpTest {

private static final Logger LOG = Logger.getLogger(W3CSearchServiceImpTest.class);

    private OASearchServiceImpl impl;

    String queryString = "http://www.example.com/search?q=finger";
    String queryStringWithPage = "http://www.example.com/search?q=finger&page=2";

    AnnotationUtils annotationUtils;
    ElasticsearchTemplate template;
    Client client;
    SearchQueryUtils searchQueryUtils;
    private TextSearchService textSearchService;
    private CacheManager cacheManager;
    Cache mixedCache;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
	annotationUtils = new AnnotationUtils();
	searchQueryUtils = new SearchQueryUtils();
	template = mock(ElasticsearchTemplate.class);
	client = mock(Client.class);
	when(template.getClient()).thenReturn(client);
	textSearchService = mock(TextSearchService.class);
// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/model/ServiceResponse.java
// public class ServiceResponse<T> implements Serializable{
// 
//     /**
//      *
//      */
//     private static final long serialVersionUID = 8231671973667011469L;
// 
//     public enum Status {
//         OK, NOT_FOUND, CACHE_KEY_MISS, ILLEGAL_MODIFICATION, NON_CONFORMANT
//     }
// 
//     private final Status status;
//     private final transient T obj;
// 
//     public ServiceResponse(Status status, T obj) {
//         this.status = status;
//         this.obj = obj;
//     }
// 
//     public Status getStatus() {
//         return status;
//     }
// 
//     public T getObj() {
//         return obj;
//     }
// }
// 
// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/model/annotation/page/PageParameters.java
// public class PageParameters {
// 
//     private int total;
// 
//     private String firstPageNumber;
//     private String lastPageNumber;
//     private String nextPageNumber;
//     private int nextPage = 0;
//     private int lastPage = 0;
//     private String previousPageNumber;
//     private String startIndexString;
// 
//     private int startIndex;
// 
//     public int getTotal() {
// 	return total;
//     }
//     public void setTotal(int total) {
// 	this.total = total;
//     }
// 
//     public String getFirstPageNumber() {
// 	return firstPageNumber;
//     }
//     public void setFirstPageNumber(String firstPageNumber) {
// 	this.firstPageNumber = firstPageNumber;
//     }
//     public String getLastPageNumber() {
// 	return lastPageNumber;
//     }
//     public void setLastPageNumber(String lastPageNumber) {
// 	this.lastPageNumber = lastPageNumber;
//     }
//     public String getNextPageNumber() {
// 	return nextPageNumber;
//     }
//     public void setNextPageNumber(String nextPageNumber) {
// 	this.nextPageNumber = nextPageNumber;
//     }
//     public String getPreviousPageNumber() {
// 	return previousPageNumber;
//     }
//     public void setPreviousPageNumber(String previousPageNumber) {
// 	this.previousPageNumber = previousPageNumber;
//     }
//     public int getStartIndex() {
// 	return startIndex;
//     }
//     public void setStartIndex(int startIndex) {
// 	this.startIndex = startIndex;
//     }
//     public int getNextPage() {
// 	return nextPage;
//     }
//     public void setNextPage(int nextPage) {
// 	this.nextPage = nextPage;
//     }
//     public int getLastPage() {
// 	return lastPage;
//     }
//     public void setLastPage(int lastPage) {
// 	this.lastPage = lastPage;
//     }
//     public String getStartIndexString() {
// 	return startIndexString;
//     }
//     public void setStartIndexString(String startIndexString) {
// 	this.startIndexString = startIndexString;
//     }
// 
// 
//     @Override
//     public String toString(){
// 	return "total:" +this.getTotal() + " startIndex:" +this.getStartIndex() + " nextPage:" + this.getNextPage() ;
//     }
// 
// }
// 
// Path: the-mathmos-server/src/main/java/com/digirati/themathmos/service/TextSearchService.java
// public interface TextSearchService {
// 
// 
// 
//    public ServiceResponse<Map<String, Object>> getTextPositions(String query, String queryString, boolean isW3c, String page, boolean isMixedSearch, String within, String widthHeight);
// 
// 
//     public long getTotalHits();
// 
//     public PageParameters getPageParameters();
// 
//     public TextUtils getTextUtils();
// 
// }


// Path: the-mathmos-server/src/test/java/com/digirati/themathmos/service/impl/OASearchServiceImpTest.java
import static org.junit.Assert.*;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.elasticsearch.action.ListenableActionFuture;
import org.elasticsearch.action.search.SearchRequestBuilder;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.client.Client;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.SearchHits;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.cache.Cache;
import org.springframework.cache.CacheManager;
import org.springframework.data.elasticsearch.core.ElasticsearchTemplate;
import com.digirati.themathmos.model.ServiceResponse;
import com.digirati.themathmos.model.annotation.page.PageParameters;
import com.digirati.themathmos.service.TextSearchService;
import com.google.common.collect.Iterators;

package com.digirati.themathmos.service.impl;





public class OASearchServiceImpTest {

private static final Logger LOG = Logger.getLogger(W3CSearchServiceImpTest.class);

    private OASearchServiceImpl impl;

    String queryString = "http://www.example.com/search?q=finger";
    String queryStringWithPage = "http://www.example.com/search?q=finger&page=2";

    AnnotationUtils annotationUtils;
    ElasticsearchTemplate template;
    Client client;
    SearchQueryUtils searchQueryUtils;
    private TextSearchService textSearchService;
    private CacheManager cacheManager;
    Cache mixedCache;

    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
    }

    @Before
    public void setUp() throws Exception {
	annotationUtils = new AnnotationUtils();
	searchQueryUtils = new SearchQueryUtils();
	template = mock(ElasticsearchTemplate.class);
	client = mock(Client.class);
	when(template.getClient()).thenReturn(client);
	textSearchService = mock(TextSearchService.class);
	mixedCache = mock(Cache.class);