PipeLineSessionBase extends HashMap<String,Object> implements IPipeLineSession { public String get(String key, String defaultValue) { String ob = this.getString(key); if (ob == null) return defaultValue; return ob; } PipeLineSessionBase();  PipeLineSessionBase(int initialCapacity);  PipeLineSessionBase(int initialCapacity, float loadFactor);  PipeLineSessionBase(Map<String, Object> t); @Override String getMessageId(); @Override String getOriginalMessage(); static void setListenerParameters(Map<String, Object> map, String messageId, String technicalCorrelationId, Date tsReceived, Date tsSent); @Override void setSecurityHandler(ISecurityHandler handler); @Override ISecurityHandler getSecurityHandler(); @Override boolean isUserInRole(String role); @Override Principal getPrincipal(); String get(String key, String defaultValue); boolean get(String key, boolean defaultValue); int get(String key, int defaultValue); long get(String key, long defaultValue); double get(String key, double defaultValue);  }
@Test public void testBoolean() { assertEquals(true, session.get("boolean1", true)); assertEquals(true, session.get("boolean1", false)); assertEquals(false, session.get("boolean2", true)); assertEquals(false, session.get("boolean2", false)); assertEquals(true, session.get("boolean3", true)); assertEquals(true, session.get("boolean3", false)); assertEquals(false, session.get("boolean4", false)); assertEquals(false, session.get("boolean4", true)); assertEquals(false, session.get("string3", true)); assertEquals(false, session.get("string4", true)); assertEquals(true, session.get("string5", true)); assertEquals(false, session.get("object1", true)); assertEquals(false, session.get("object1", false)); }
@Test public void testString() { assertEquals("test", session.get("string1", "")); assertEquals("test", session.get("string1", "not test")); assertEquals("true", session.get("string2", "")); assertEquals("true", session.get("string2", "false")); assertEquals("", session.get("string3", "")); assertEquals("", session.get("string3", "not empty")); assertEquals("null", session.get("string4", "null")); assertEquals("null", session.get("string4", "not null")); assertEquals(null, session.get("string5", null)); assertEquals("", session.get("string5", new String())); }
@Test public void testInt() { assertEquals(0, session.get("int1", 0)); assertEquals(0, session.get("int1", -123)); assertEquals(1, session.get("int2", 0)); assertEquals(1, session.get("int2", -123)); assertEquals(-1, session.get("int3", 0)); assertEquals(-1, session.get("int3", -123)); assertEquals(0, session.get("int4", 0)); assertEquals(0, session.get("int4", -123)); assertEquals(1, session.get("int5", 0)); assertEquals(1, session.get("int5", -123)); assertEquals(-1, session.get("int6", 0)); assertEquals(-1, session.get("int6", -123)); assertEquals(123, session.get("non-existing-key", 123)); }
@Test public void testDouble() { assertEquals(1.0, session.get("double1", 0d), DELTA); assertEquals(1, session.get("double1", -123d), DELTA); assertEquals(1.23, session.get("double2", 0d), DELTA); assertEquals(1.23, session.get("double2", -123d), DELTA); assertEquals(0, session.get("double3", 0d), DELTA); assertEquals(0, session.get("double3", -123d), DELTA); assertEquals(0, session.get("double4", 0d), DELTA); assertEquals(0, session.get("double4", -123d), DELTA); assertEquals(123.456, session.get("double5", 0d), DELTA); assertEquals(123.456, session.get("double5", -123d), DELTA); }
@Test public void testLong() { assertEquals(1L, session.get("long1", 0L)); assertEquals(1L, session.get("long1", -123L)); assertEquals(-1L, session.get("long2", 0L)); assertEquals(-1L, session.get("long2", -123L)); assertEquals(12345678910L, session.get("long3", 0L)); assertEquals(12345678910L, session.get("long3", -123L)); }
@Test public void testObject() { assertEquals(TEST_OBJECT, session.get("object1")); assertEquals(TEST_OBJECT.toString(), session.get("object1", "dummy")); }