Search in sources :

Example 1 with Tag

use of net.glowstone.util.nbt.Tag in project Glowstone by GlowstoneMC.

the class MojangsonParseTest method canParseType.

@Test
public void canParseType() {
    try {
        CompoundTag compound = Mojangson.parseCompound(testCase.getValue());
        Tag value = compound.getValue().get("value");
        // Checks if the TagType of the case and the parsed type are equal.
        if (value.getType() != testCase.getKey()) {
            fail("Incorrect type parsing for case " + testCase.getKey().getName() + " (Got " + value.getType().getName() + ") for Mojansgon: " + testCase.getValue());
        }
    } catch (MojangsonParseException e) {
        // Catches a parse failure.
        fail("Could not parse case for " + testCase.getKey().getName() + "( " + testCase.getValue() + "): " + e.getMessage());
    }
}
Also used : MojangsonParseException(net.glowstone.util.mojangson.ex.MojangsonParseException) CompoundTag(net.glowstone.util.nbt.CompoundTag) Tag(net.glowstone.util.nbt.Tag) CompoundTag(net.glowstone.util.nbt.CompoundTag) Test(org.junit.Test)

Aggregations

MojangsonParseException (net.glowstone.util.mojangson.ex.MojangsonParseException)1 CompoundTag (net.glowstone.util.nbt.CompoundTag)1 Tag (net.glowstone.util.nbt.Tag)1 Test (org.junit.Test)1