Skip to content

Commit

Permalink
move more android tests
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecsl committed Jun 11, 2024
1 parent 339bc6f commit 5eac1b7
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/test/java/cloud/eppo/UtilsTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package cloud.eppo;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;

import java.util.Date;

import static cloud.eppo.Utils.parseUtcISODateElement;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;

public class UtilsTest {
@Test
public void testParseUtcISODateElement() throws JsonProcessingException {
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonNode = mapper.readTree("\"2024-05-01T16:13:26.651Z\"");
Date parsedDate = parseUtcISODateElement(jsonNode);
Date expectedDate = new Date(1714580006651L);
assertEquals(expectedDate, parsedDate);
jsonNode = mapper.readTree("null");
parsedDate = parseUtcISODateElement(jsonNode);
assertNull(parsedDate);
assertNull(parseUtcISODateElement(null));
}
}

0 comments on commit 5eac1b7

Please sign in to comment.