### Question:
OwlApiUtils { public static Optional<Object> getTypedLiteralValue(OWLLiteral literal) { Object literalValue = null; if (literal.isBoolean()) { literalValue = literal.parseBoolean(); } else if (literal.isInteger()) { literalValue = literal.parseInteger(); } else if (literal.isFloat()) { literalValue = literal.parseFloat(); } else if (literal.isDouble()) { literalValue = literal.parseDouble(); } else { if (literal.hasLang() && !literal.getLang().startsWith("en")) { if (!unknownLanguages.contains(literal.getLang())) { unknownLanguages.add(literal.getLang()); logger.warning("Ignoring *all* literals with unsupported language: \"" + literal.getLang() + "\"."); } return Optional.empty(); } literalValue = literal.getLiteral(); } return Optional.of(literalValue); }  static Optional<Object> getTypedLiteralValue(OWLLiteral literal); static String getIri(OWLDeclarationAxiom expression); static String getIri(OWLClassExpression expression); static String getIri(OWLObjectPropertyExpression property); static String getIri(OWLIndividual individual); static String getIri(OWLAnnotationProperty property); static String getIri(OWLOntology ontology); static OWLOntology loadOntology(OWLOntologyManager manager, String ontology); static synchronized void silenceOboParser();  }### Answer:
@Test public void testGetBooleanTypedLiteral() { OWLLiteral bool = factory.getOWLLiteral(false); assertThat(OwlApiUtils.getTypedLiteralValue(bool).get(), IsInstanceOf.instanceOf(Boolean.class)); assertThat((Boolean)OwlApiUtils.getTypedLiteralValue(bool).get(), is(false)); }
@Test public void testGetNumericTypedLiterals() { OWLLiteral doub = factory.getOWLLiteral(3.14); assertThat((Double) OwlApiUtils.getTypedLiteralValue(doub).get(), is(3.14)); OWLLiteral flt = factory.getOWLLiteral(3.14f); assertThat((Float) OwlApiUtils.getTypedLiteralValue(flt).get(), is(3.14f)); OWLLiteral i = factory.getOWLLiteral(3); assertThat((Integer) OwlApiUtils.getTypedLiteralValue(i).get(), is(3)); }
@Test public void testGetStringTypedLiterals() { OWLLiteral literal = factory.getOWLLiteral("hello", "en"); assertThat((String) OwlApiUtils.getTypedLiteralValue(literal).get(), is("hello")); }
@Test public void testLiteralLanguages() { OWLLiteral literalEnLang = factory.getOWLLiteral("hello", "en"); OWLLiteral literalEsLang = factory.getOWLLiteral("hello", "es"); assertThat((String) OwlApiUtils.getTypedLiteralValue(literalEnLang).get(), is("hello")); assertThat(OwlApiUtils.getTypedLiteralValue(literalEsLang), is(Optional.empty())); }