Inherit TestDateTimeOperators from AbstractTestFunctions
*/
package com.facebook.presto.type;
-import com.facebook.presto.Session;
-import com.facebook.presto.operator.scalar.FunctionAssertions;
+import com.facebook.presto.operator.scalar.AbstractTestFunctions;
import com.facebook.presto.spi.PrestoException;
import com.facebook.presto.spi.type.SqlDate;
import com.facebook.presto.spi.type.SqlTime;
@@ -22,11 +21,8 @@ import com.facebook.presto.spi.type.SqlTimeWithTimeZone;
import com.facebook.presto.spi.type.SqlTimestamp;
import com.facebook.presto.spi.type.SqlTimestampWithTimeZone;
import com.facebook.presto.spi.type.TimeZoneKey;
-import com.facebook.presto.spi.type.Type;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.concurrent.TimeUnit;
@@ -42,39 +38,23 @@ import static com.facebook.presto.spi.type.TimestampWithTimeZoneType.TIMESTAMP_W
import static com.facebook.presto.spi.type.VarcharType.VARCHAR;
import static com.facebook.presto.testing.TestingSession.testSessionBuilder;
import static com.facebook.presto.util.DateTimeZoneIndex.getDateTimeZone;
-import static io.airlift.testing.Closeables.closeAllRuntimeException;
import static java.util.concurrent.TimeUnit.HOURS;
import static org.joda.time.DateTimeZone.UTC;
import static org.testng.Assert.assertThrows;
public class TestDateTimeOperators
+ extends AbstractTestFunctions
{
private static final TimeZoneKey TIME_ZONE_KEY = getTimeZoneKey("Europe/Berlin");
private static final DateTimeZone TIME_ZONE = getDateTimeZone(TIME_ZONE_KEY);
private static final DateTimeZone WEIRD_TIME_ZONE = DateTimeZone.forOffsetHoursMinutes(5, 9);
private static final TimeZoneKey WEIRD_TIME_ZONE_KEY = getTimeZoneKeyForOffset(5 * 60 + 9);
- private FunctionAssertions functionAssertions;
-
- @BeforeClass
- public void setUp()
+ public TestDateTimeOperators()
{
- Session session = testSessionBuilder()
+ super(testSessionBuilder()
.setTimeZoneKey(TIME_ZONE_KEY)
- .build();
- functionAssertions = new FunctionAssertions(session);
- }
-
- @AfterClass(alwaysRun = true)
- public void tearDown()
- {
- closeAllRuntimeException(functionAssertions);
- functionAssertions = null;
- }
-
- private void assertFunction(String projection, Type expectedType, Object expected)
- {
- functionAssertions.assertFunction(projection, expectedType, expected);
+ .build());
}
@Test
