package hu.supercluster.overpasser.library.query;

import org.junit.Before;
import org.junit.Test;
import org.mockito.BDDMockito;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;

public class OverpassFilterQueryTest {
    static final String START_TOKEN = "; (";
    static final String END_TOKEN = ";<;)";
    @Mock OverpassQueryBuilder builder;
    @Mock OverpassQuery query;
    OverpassFilterQuery filterQuery;

    public OverpassFilterQueryTest() {
        MockitoAnnotations.initMocks(this);
    }

    @Before
    public void setUp() throws Exception {
        filterQuery = new OverpassFilterQuery(query, builder);

        verify(builder).append(START_TOKEN);
    }

    @Test
    public void testBuild() throws Exception {
        filterQuery.build();

        verify(builder).append(END_TOKEN);
        verify(builder).build();
        verifyNoMoreInteractions(builder);
    }

    @Test
    public void testNode() throws Exception {
        filterQuery.node();

        verify(builder).append("node");
        verifyNoMoreInteractions(builder);
    }

    @Test
    public void testWay() throws Exception {
        filterQuery.way();

        verify(builder).append("way");
        verifyNoMoreInteractions(builder);
    }

    @Test
    public void testPrepareNext() throws Exception {
        filterQuery
                .node()
                .prepareNext()
                .way()
        ;

        verify(builder).append("node");
        verify(builder).append("; ");
        verify(builder).append("way");
        verifyNoMoreInteractions(builder);
    }
}
@@ -96,39 +96,8 @@
 st;%0A
-import org.mockito.BDDMockito;%0A
 impo
@@ -117,16 +117,16 @@
 o.Mock;%0A
+
 import o
@@ -168,46 +168,53 @@
 ort 
-static org.junit.Assert.assertEquals
+java.util.Arrays;%0Aimport java.util.HashSet
 ;%0A
+%0A
 impo
@@ -440,16 +440,17 @@
 %22;%3C;)%22;%0A
+%0A
     @Moc
@@ -1652,32 +1652,32 @@
 .append(%22way%22);%0A
-
         verifyNo
@@ -1709,9 +1709,1838 @@
 ;%0A    %7D%0A
+%0A%0A    @Test%0A    public void testAmenity() throws Exception %7B%0A        filterQuery.amenity(%22parking%22);%0A%0A        verify(builder).equals(%22amenity%22, %22parking%22);%0A    %7D%0A%0A    @Test%0A    public void testAmenities() throws Exception %7B%0A        final HashSet%3CString%3E amenities = new HashSet%3C%3E(Arrays.asList(%22shop%22, %22market%22));%0A        filterQuery.amenities(amenities);%0A%0A        verify(builder).multipleValues(%22amenity%22, amenities);%0A    %7D%0A%0A    @Test%0A    public void testEquals() throws Exception %7B%0A        filterQuery.equals(%22foo%22, %22bar%22);%0A%0A        verify(builder).equals(%22foo%22, %22bar%22);%0A    %7D%0A%0A    @Test%0A    public void testNotEquals() throws Exception %7B%0A        filterQuery.notEquals(%22foo%22, %22bar%22);%0A%0A        verify(builder).notEquals(%22foo%22, %22bar%22);%0A    %7D%0A%0A    @Test%0A    public void testMultipleValues() throws Exception %7B%0A        final HashSet%3CString%3E values = new HashSet%3C%3E(Arrays.asList(%22bar%22, %22baz%22));%0A        filterQuery.multipleValues(%22foo%22, values);%0A%0A        verify(builder).multipleValues(%22foo%22, values);%0A    %7D%0A%0A    @Test%0A    public void testRegexMatches() throws Exception %7B%0A        filterQuery.regexMatches(%22foo%22, %22bar%22);%0A%0A        verify(builder).regexMatches(%22foo%22, %22bar%22);%0A    %7D%0A%0A    @Test%0A    public void testRegexDoesntMatch() throws Exception %7B%0A        filterQuery.regexDoesntMatch(%22foo%22, %22bar%22);%0A%0A        verify(builder).regexDoesntMatch(%22foo%22, %22bar%22);%0A    %7D%0A%0A    @Test%0A    public void testStandaloneParam() throws Exception %7B%0A        filterQuery.standaloneParam(%22foo%22);%0A%0A        verify(builder).standaloneParam(%22foo%22);%0A    %7D%0A%0A    @Test%0A    public void testBoundingBox() throws Exception %7B%0A        double lat1 = 1.0d;%0A        double lon1 = 2.0d;%0A        double lat2 = 3.0d;%0A        double lon2 = 4.0d;%0A        filterQuery.boundingBox(lat1, lon1, lat2, lon2);%0A%0A        verify(builder).boundingBox(lat1, lon1, lat2, lon2);%0A    %7D%0A
 %7D

Add tests for left out methods