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.util.validators.identifierschemes; 015 016import org.junit.jupiter.api.Test; 017 018import static org.junit.jupiter.api.Assertions.assertFalse; 019import static org.junit.jupiter.api.Assertions.assertTrue; 020 021/** Tests the {@link HuhValidator}. */ 022public class HuhValidatorTest { 023 024 private static final HuhValidator VALIDATOR = new HuhValidator(); 025 026 @Test 027 public void kikiIsValidTest() { 028 assertTrue( 029 VALIDATOR.isValid( 030 "https://kiki.huh.harvard.edu/databases/rdfgen.php?uuid=fbb65596-0611-4406-b510-bf45d45ec6e2")); 031 assertTrue( 032 VALIDATOR.isValid( 033 "http://kiki.huh.harvard.edu/databases/rdfgen.php?uuid=fbb65596-0611-4406-b510-bf45d45ec6e2")); 034 assertTrue( 035 VALIDATOR.isValid( 036 "https://kiki.huh.harvard.edu/databases/rdfgen.php?uuid=fbb65596-0611-4406-b510-bf45d45ec6e2")); 037 assertTrue( 038 VALIDATOR.isValid( 039 "http://kiki.huh.harvard.edu/databases/rdfgen.php?uuid=fbb65596-0611-4406-b510-bf45d45ec6e2")); 040 assertTrue( 041 VALIDATOR.isValid( 042 "https://kiki.huh.harvard.edu/databases/botanist_search.php?mode=details&id=44949")); 043 assertTrue( 044 VALIDATOR.isValid("https://kiki.huh.harvard.edu/databases/botanist_search.php?id=44949")); 045 assertTrue( 046 VALIDATOR.isValid( 047 "http://kiki.huh.harvard.edu/databases/botanist_search.php?mode=details&id=44949")); 048 049 assertFalse( 050 VALIDATOR.isValid( 051 "https://kiki.huh.harvard.edu/databases/rdfgen.php?uuid=fbb65596-0611-4406-b510-bf45d45ec6e")); 052 assertFalse( 053 VALIDATOR.isValid("http://kiki.huh.harvard.edu/databases/botanist_search.php?id=4d4949")); 054 } 055 056 @Test 057 public void purlIsValidTest() { 058 assertTrue( 059 VALIDATOR.isValid( 060 "http://purl.oclc.org/net/edu.harvard.huh/guid/uuid/f5ea5399-24c6-4ad9-a04e-c24c3f215bae")); 061 assertTrue( 062 VALIDATOR.isValid( 063 "https://purl.oclc.org/net/edu.harvard.huh/guid/uuid/f5ea5399-24c6-4ad9-a04e-c24c3f215bae")); 064 065 assertFalse( 066 VALIDATOR.isValid( 067 "https://purl.oclc.org/net/edu.harvard.huh/guid/uuid/f5ea5399-24c6-4ad9-a04e-c24c3f215ba2e")); 068 } 069}