Skip to content

Commit

Permalink
Create DataElementTest.
Browse files Browse the repository at this point in the history
  • Loading branch information
thegatesdev committed Nov 12, 2022
1 parent 1ea030e commit 7edcd90
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/test/java/com/thegates/maple/data/DataElementTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.thegates.maple.data;

import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

public class DataElementTest {

private DataMap testMap;

@BeforeEach
void setUp() {
testMap = new DataMap("named").put("test_element", new DataPrimitive("test_value"));
}

@Test
void path() {
assert testMap.navigate("test_element").path().equals("named.test_element");
}

@Test
void isOf() {
assert testMap.navigate("test_element").isOf(DataPrimitive.class);
}

@Test
void getAsOrNull() {
assert testMap.navigate("test_element").getAsOrNull(DataMap.class) == null;
assert testMap.navigate("test_element").getAsOrNull(DataPrimitive.class) != null;
}

@AfterEach
void tearDown() {
testMap = null;
}
}

0 comments on commit 7edcd90

Please sign in to comment.