001/*
002 * Copyright 2020 Global Biodiversity Information Facility (GBIF)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.gbif.api.model.common.search;
017
018import org.gbif.api.model.checklistbank.search.NameUsageSearchParameter;
019
020import java.util.ArrayList;
021import java.util.List;
022
023import org.junit.jupiter.api.Test;
024
025import static org.junit.jupiter.api.Assertions.assertEquals;
026
027/**
028 * Tests for model class Facet
029 */
030public class FacetTest {
031
032  @Test
033  public void testEquals() {
034    List<Facet.Count> counts = new ArrayList<Facet.Count>();
035    counts.add(new Facet.Count("c1", 1L));
036    counts.add(new Facet.Count("c3", 2L));
037    counts.add(new Facet.Count("c4", 3L));
038
039    NameUsageSearchParameter field = NameUsageSearchParameter.RANK;
040    Facet<NameUsageSearchParameter> facet1 = new Facet<NameUsageSearchParameter>(field, counts);
041    Facet<NameUsageSearchParameter> facet2 = new Facet<NameUsageSearchParameter>(field, counts);
042
043    assertEquals(facet1, facet2);
044  }
045}