ImmutableLogicalFilter implements LogicalSearchFilter { public static ImmutableLogicalFilter and(final SearchFilter filter1, final SearchFilter filter2, final SearchFilter... furtherFilters) { checkNotNull(filter1, "first filter to be concatenated with AND"); checkNotNull(filter2, "second filter to be concatenated with AND"); checkNotNull(furtherFilters, "further searchFilters to be concatenated with AND"); return new ImmutableLogicalFilter(Type.AND, paramsToList(filter1, filter2, furtherFilters)); } private  ImmutableLogicalFilter(final Type theFilterType, final Collection<SearchFilter> theFilters); static ImmutableLogicalFilter not(final SearchFilter filter); static ImmutableLogicalFilter and(final SearchFilter filter1, final SearchFilter filter2,
            final SearchFilter... furtherFilters); static ImmutableLogicalFilter or(final SearchFilter filter1, final SearchFilter filter2,
            final SearchFilter... furtherFilters); @Override Type getType(); @Override Collection<SearchFilter> getFilters(); @Override boolean equals(final Object o); @Override int hashCode(); @Override String toString();  }
@Test(expected = NullPointerException.class) public void tryToCreateAndFilterWithNullFirstFilter() { ImmutableLogicalFilter.and(null, searchFilterMock); }
@Test(expected = NullPointerException.class) public void tryToCreateAndFilterWithNullSecondFilter() { ImmutableLogicalFilter.and(searchFilterMock, null); }
@Test(expected = NullPointerException.class) public void tryToCreateAndFilterWithNullAdditionalFilters() { ImmutableLogicalFilter.and(searchFilterMock, searchFilterMock, null); }
@Test public void createAndFilter() { final ImmutableLogicalFilter underTest = ImmutableLogicalFilter.and(searchFilterMock, searchFilterMock, searchFilterMock, searchFilterMock); assertThat(underTest) .hasType(SearchFilter.Type.AND) .containsAmountOfFilters(4) .containsOnlyFilter(searchFilterMock); }