@Test public void testSetWithKeyAndType() { TestContext ctx = new TestContext.Builder().set("MyNum", 2).build(); assertNull(ctx.get(String.class)); assertEquals(Integer.valueOf(2), ctx.getInt("MyNum")); assertEquals(ctx.get("MyNum", Number.class), 2); assertNotNull(ctx.get("MyNum", Integer.class)); }
@Test public void testSetWithKey() { TestContext ctx = new TestContext.Builder().set("myKey", "Test").build(); assertNull(ctx.get(String.class)); assertEquals("Test", ctx.get("myKey", String.class)); assertEquals(ctx.get("myKey", String.class), "Test"); assertEquals(ctx.get(String.class.getName(), String.class), null); }