View Javadoc
1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements. See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership. The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.commons.rdf.simple;
19  
20  import static org.junit.Assert.assertEquals;
21  import static org.junit.Assert.assertFalse;
22  import static org.junit.Assert.assertTrue;
23  
24  import org.junit.Test;
25  
26  /**
27   * Tests for the {@link org.apache.commons.rdf.simple.Types} enumeration.
28   */
29  public class TypesTest {
30  
31      /**
32       * Test method for
33       * {@link org.apache.commons.rdf.simple.Types#getIRIString()} .
34       */
35      @Test
36      public final void testGetIRIString() {
37          assertEquals("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString", Types.RDF_LANGSTRING.getIRIString());
38      }
39  
40      /**
41       * Test method for
42       * {@link org.apache.commons.rdf.simple.Types#ntriplesString()}.
43       */
44      @Test
45      public final void testNtriplesString() {
46          assertEquals("<http://www.w3.org/1999/02/22-rdf-syntax-ns#langString>", Types.RDF_LANGSTRING.ntriplesString());
47      }
48  
49      /**
50       * Test method for
51       * {@link org.apache.commons.rdf.simple.Types#get(org.apache.commons.rdf.api.IRI)}
52       * .
53       */
54      @Test
55      public final void testGet() {
56          assertTrue(Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#boolean")).isPresent());
57          assertEquals("http://www.w3.org/2001/XMLSchema#boolean",
58                  Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#boolean")).get().getIRIString());
59          assertFalse(Types.get(new IRIImpl("http://www.w3.org/2001/XMLSchema#nonExistent")).isPresent());
60      }
61  
62  }