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.crawler; 017 018import org.gbif.api.vocabulary.EndpointType; 019 020import java.net.URI; 021import java.util.HashMap; 022import java.util.Map; 023import java.util.UUID; 024 025import org.junit.jupiter.api.Test; 026 027import static org.junit.jupiter.api.Assertions.assertEquals; 028 029public class CrawlJobTest { 030 031 @Test 032 public void testEquals() { 033 Map<String, String> m1 = new HashMap<>(); 034 m1.put("foo", "bar"); 035 CrawlJob c1 = new CrawlJob(UUID.randomUUID(), EndpointType.BIOCASE, URI.create("http://www.foo.com"), 1, m1); 036 037 Map<String, String> m2 = new HashMap<>(); 038 m2.put("foo", "bar"); 039 CrawlJob c2 = new CrawlJob(UUID.fromString(c1.getDatasetKey().toString()), 040 EndpointType.BIOCASE, 041 URI.create("http://www.foo.com"), 042 1, 043 m2); 044 045 assertEquals(c1, c2); 046 assertEquals(c1.hashCode(), c2.hashCode()); 047 } 048}