Sha256: 871e45fb1aab5d61d9ccd2cabb18cc8627bca64ee93e75d94bf2044b45efa315

Contents?: true

Size: 941 Bytes

Versions: 5

Compression:

Stored size: 941 Bytes

Contents

package org.embulk.filter.typecast.cast;

import org.embulk.spi.DataException;
import org.embulk.spi.time.Timestamp;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class TestLongCast
{
    @Test
    public void asBoolean()
    {
        assertEquals(true, LongCast.asBoolean(1));
        assertEquals(false, LongCast.asBoolean(0));
    }

    @Test
    public void asLong()
    {
        assertEquals(1, LongCast.asLong(1));
    }

    @Test
    public void asDouble()
    {
        assertEquals(1.0, LongCast.asDouble(1), 0.0);
    }

    @Test
    public void asString()
    {
        assertEquals("1", LongCast.asString(1));
    }

    @Test(expected = DataException.class)
    public void asJson()
    {
        LongCast.asJson(1);
    }

    @Test
    public void asTimestamp()
    {
        Timestamp expected = Timestamp.ofEpochSecond(1);
        assertEquals(expected, LongCast.asTimestamp(1));
    }
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embulk-filter-typecast-0.2.2 src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java
embulk-filter-typecast-0.2.1 src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java
embulk-filter-typecast-0.2.0 src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java
embulk-filter-typecast-0.1.5 src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java
embulk-filter-typecast-0.1.4 src/test/java/org/embulk/filter/typecast/cast/TestLongCast.java