-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ea030e
commit 7edcd90
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/test/java/com/thegates/maple/data/DataElementTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
} |