@Test public void getPropertyCount_shouldReturnTwo() throws Exception { pb.addProperty("test", "42"); pb.addProperty("number", 42); assertTrue(pb.propertyCount() == 2); }
@Test public void testWildeCatComperator_shouldSucceed() throws Exception { ProcessBag processBag = new ProcessBag(); processBag.setContext("blub"); processBag.setProcessId("lala"); processBag.setUser("cool"); assertTrue(new ProcessBag().equals(processBag)); }
@Test public void removeAllProperties_shouldDeleteEverything() throws Exception { pb.addProperty("test", "42"); pb.addProperty("number", 42); pb.removeAllProperties(); assertTrue(pb.propertyCount() == 0); }
@Test public void getPropertyKeyList_shouldReturnTwo() throws Exception { pb.addProperty("test", "42"); pb.addProperty("number", 42); Set<String> list = pb.propertyKeySet(); assertThat(list.size(), is(2)); }
@Test public void testRhsEmptyProperties_shouldFail() throws Exception { ProcessBag processBag = new ProcessBag(); Map<String, Object> props = Maps.newHashMap(); props.put("a", "b"); processBag.setProperties(props); assertFalse(processBag.equals(new ProcessBag())); }
@Test public void testLhsEmptyProperties_shouldSucceed() throws Exception { ProcessBag processBag = new ProcessBag(); HashMap<String, Object> props = Maps.newHashMap(); props.put("a", "b"); processBag.setProperties(props); assertTrue(new ProcessBag().equals(processBag)); }
@Test public void removeProperty_shouldContainStringOnly() throws Exception { pb.addProperty("number", 42); pb.addProperty("string", "42"); pb.removeProperty("number"); Set<String> list = pb.propertyKeySet(); assertTrue(list.contains("string")); assertFalse(list.contains("number")); }
@Test public void testRhsInequalToLhs_shouldFail() throws Exception { ProcessBag processBag = new ProcessBag(); processBag.setContext("blub"); processBag.setProcessId("lala"); processBag.setUser("uncool"); ProcessBag processBag2 = new ProcessBag(); processBag2.setContext("blub"); processBag2.setProcessId("lala"); processBag2.setUser("cool"); assertFalse(processBag.equals(processBag2)); }
@Test public void addOrReplaceProperty_shouldOverwriteValue() throws Exception { pb.addProperty("test", "42"); pb.addOrReplaceProperty("test", "43"); assertEquals(pb.getProperty("test"), "43"); }
@Test public void getPropertyClass_shouldReturnStringClass() throws Exception { pb.addProperty("test", "42"); assertTrue(pb.getPropertyClass("test") == String.class); }
@Test(expected = ProcessBagException.class) public void addProperty_shouldReturnException() throws ProcessBagException { pb.addProperty("test", "42"); pb.addProperty("test", "42"); }