001/* 002 * Licensed under the Apache License, Version 2.0 (the "License"); 003 * you may not use this file except in compliance with the License. 004 * You may obtain a copy of the License at 005 * 006 * http://www.apache.org/licenses/LICENSE-2.0 007 * 008 * Unless required by applicable law or agreed to in writing, software 009 * distributed under the License is distributed on an "AS IS" BASIS, 010 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 011 * See the License for the specific language governing permissions and 012 * limitations under the License. 013 */ 014package org.gbif.api.model.predicate; 015 016import org.junit.jupiter.api.Test; 017 018import static org.hamcrest.CoreMatchers.equalTo; 019import static org.hamcrest.MatcherAssert.assertThat; 020import static org.junit.jupiter.api.Assertions.assertThrows; 021 022public class FullTextSearchPredicateTest { 023 024 private static final String TEST_VALUE = "bar"; 025 private static final String COMP_VALUE = "bar "; 026 027 @Test 028 public void testEmptyConstructor() { 029 assertThrows(IllegalArgumentException.class, () -> new FullTextSearchPredicate(null)); 030 assertThrows(IllegalArgumentException.class, () -> new FullTextSearchPredicate(" ")); 031 } 032 033 @Test 034 public void testEquals() { 035 FullTextSearchPredicate ep1 = new FullTextSearchPredicate(TEST_VALUE); 036 FullTextSearchPredicate ep2 = new FullTextSearchPredicate(COMP_VALUE); 037 038 // All of them are equal to themselves 039 assertThat(ep1, equalTo(ep2)); 040 } 041}