Sha256: 99ac74dc20154084c14d3b5678c699711682502ce01e7eea6f1276517b5f3d18

Contents?: true

Size: 1.35 KB

Versions: 4

Compression:

Stored size: 1.35 KB

Contents

package org.embulk.input.zendesk.utils;

import org.embulk.spi.DataException;
import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertThrows;

public class TestZendeskDateUtils
{
    @Test
    public void isoToEpochSecondShouldReturnCorrectValue()
    {
        long expectedValue = 1550645445;

        long value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45Z");
        Assert.assertEquals(expectedValue, value);

        value = ZendeskDateUtils.isoToEpochSecond("2019-02-20 06:50:45 +0000");
        Assert.assertEquals(expectedValue, value);

        value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45.000Z");
        Assert.assertEquals(expectedValue, value);

        value = ZendeskDateUtils.isoToEpochSecond("2019-02-20T06:50:45+00:00");
        Assert.assertEquals(expectedValue, value);
    }

    @Test
    public void isoToEpochSecondShouldThrowException()
    {
        assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02asdasdasd-20T06:50:45Z"));
        assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-002-20T06:50:45Z"));
        assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02-200T06:50:45.000Z"));
        assertThrows(DataException.class, () -> ZendeskDateUtils.isoToEpochSecond("2019-02-20T24:01:00Z"));
    }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
embulk-input-zendesk-0.3.3 src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java
embulk-input-zendesk-0.3.2 src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java
embulk-input-zendesk-0.3.1 src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java
embulk-input-zendesk-0.3.0 src/test/java/org/embulk/input/zendesk/utils/TestZendeskDateUtils.java