Search in sources :

Example 16 with JsonProcessorInjectionMap

use of com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap in project Engine by VoltzEngine-Project.

the class TestProcessorInjection method testJsonByte.

@Test
public void testJsonByte() {
    JsonProcessorInjectionMap map = new JsonProcessorInjectionMap(InjectionTestClass.class);
    InjectionTestClass object = new InjectionTestClass();
    assertTrue(map.handle(object, "b", new JsonPrimitive((byte) 1)));
    assertEquals(1, object.b);
    assertTrue(map.handle(object, "b2", new JsonPrimitive((byte) 2)));
    assertEquals(2, object.b);
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonProcessorInjectionMap(com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap) Test(org.junit.Test)

Example 17 with JsonProcessorInjectionMap

use of com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap in project Engine by VoltzEngine-Project.

the class TestProcessorInjection method testJsonShort.

@Test
public void testJsonShort() {
    JsonProcessorInjectionMap map = new JsonProcessorInjectionMap(InjectionTestClass.class);
    InjectionTestClass object = new InjectionTestClass();
    assertTrue(map.handle(object, "s", new JsonPrimitive((short) 1)));
    assertEquals(1, object.s);
    assertTrue(map.handle(object, "s2", new JsonPrimitive((short) 2)));
    assertEquals(2, object.s);
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonProcessorInjectionMap(com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap) Test(org.junit.Test)

Example 18 with JsonProcessorInjectionMap

use of com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap in project Engine by VoltzEngine-Project.

the class TestProcessorInjection method testMethod.

@Test
public void testMethod() {
    JsonProcessorInjectionMap map = new JsonProcessorInjectionMap(InjectionTestClass.class);
    InjectionTestClass object = new InjectionTestClass();
    assertTrue(map.handle(object, "key2", "String"));
    assertEquals("String", object.key);
}
Also used : JsonProcessorInjectionMap(com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap) Test(org.junit.Test)

Example 19 with JsonProcessorInjectionMap

use of com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap in project Engine by VoltzEngine-Project.

the class TestProcessorInjection method testJsonInteger.

@Test
public void testJsonInteger() {
    JsonProcessorInjectionMap map = new JsonProcessorInjectionMap(InjectionTestClass.class);
    InjectionTestClass object = new InjectionTestClass();
    assertTrue(map.handle(object, "i", new JsonPrimitive(1)));
    assertEquals(1, object.i);
    assertTrue(map.handle(object, "i3", new JsonPrimitive(2)));
    assertEquals(2, object.i);
    assertTrue(map.handle(object, "i2", new JsonPrimitive(3)));
    assertEquals(3, object.i2);
    assertTrue(map.handle(object, "i4", new JsonPrimitive(4)));
    assertEquals(4, object.i2);
}
Also used : JsonPrimitive(com.google.gson.JsonPrimitive) JsonProcessorInjectionMap(com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap) Test(org.junit.Test)

Aggregations

JsonProcessorInjectionMap (com.builtbroken.mc.lib.json.loading.JsonProcessorInjectionMap)19 Test (org.junit.Test)18 JsonPrimitive (com.google.gson.JsonPrimitive)7 JsonElement (com.google.gson.JsonElement)2 ITileEventListener (com.builtbroken.mc.api.tile.listeners.ITileEventListener)1 JsonArray (com.google.gson.JsonArray)1 JsonObject (com.google.gson.JsonObject)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1