NowTest.java
/*******************************************************************************
* Copyright (c) 2021 Eclipse RDF4J contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*******************************************************************************/
package org.eclipse.rdf4j.query.algebra.evaluation.function.datetime;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.fail;
import org.eclipse.rdf4j.model.Literal;
import org.eclipse.rdf4j.model.ValueFactory;
import org.eclipse.rdf4j.model.impl.SimpleValueFactory;
import org.eclipse.rdf4j.model.vocabulary.XSD;
import org.eclipse.rdf4j.query.algebra.evaluation.ValueExprEvaluationException;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
/**
* @author jeen
*/
public class NowTest {
private Now now;
private ValueFactory f = SimpleValueFactory.getInstance();
/**
*/
@BeforeEach
public void setUp() {
now = new Now();
}
/**
*/
@AfterEach
public void tearDown() {
}
@Test
public void testEvaluate() {
try {
Literal nowL = now.evaluate(f);
assertNotNull(nowL);
assertEquals(XSD.DATETIME, nowL.getDatatype());
} catch (ValueExprEvaluationException e) {
e.printStackTrace();
fail(e.getMessage());
}
}
}