public void testAddChannelStateStringComponentState() { AdapterStateSummary s1 = new AdapterStateSummary(); s1.addChannelState(DEFAULT_KEY, ClosedState.getInstance()); assertEquals(1, s1.getChannelStates().size()); assertTrue(s1.getChannelStates().contains(new KeyValuePair(DEFAULT_KEY, ""))); assertEquals(DEFAULT_KEY, s1.getChannelStates().getKeyValuePair(DEFAULT_KEY).getKey()); assertEquals( ClosedState.getInstance().getClass().getName(), s1.getChannelStates().getKeyValuePair(DEFAULT_KEY).getValue()); s1.addChannelState("", ClosedState.getInstance()); assertEquals(1, s1.getChannelStates().size()); s1.addChannelState(null, ClosedState.getInstance()); assertEquals(1, s1.getChannelStates().size()); try { s1.addChannelState(DEFAULT_KEY, null); fail("Null Component State"); } catch (IllegalArgumentException expected) { } }
public void testSetAdapterStateKeyValuePair() { AdapterStateSummary s1 = new AdapterStateSummary(); s1.setAdapterState( new KeyValuePair(DEFAULT_KEY, ClosedState.getInstance().getClass().getName())); assertEquals(DEFAULT_KEY, s1.getAdapterState().getKey()); assertEquals(ClosedState.getInstance().getClass().getName(), s1.getAdapterState().getValue()); try { s1.setAdapterState(new KeyValuePair("", "ABC")); fail("Null Key in KeyValuePair"); } catch (IllegalArgumentException expected) { } try { s1.setAdapterState(new KeyValuePair("ABC", "")); fail("Null Value in KeyValuePair"); } catch (IllegalArgumentException expected) { } try { s1.setAdapterState(null); fail("Null KeyValuePair"); } catch (IllegalArgumentException expected) { } }
public void testSetAdapterStateStringComponentState() throws Exception { Adapter a = new Adapter(); a.setUniqueId(DEFAULT_KEY); AdapterStateSummary s1 = new AdapterStateSummary(a); s1.setAdapterState(DEFAULT_KEY, ClosedState.getInstance()); assertEquals(DEFAULT_KEY, s1.getAdapterState().getKey()); assertEquals(ClosedState.getInstance().getClass().getName(), s1.getAdapterState().getValue()); s1.setAdapterState("", ClosedState.getInstance()); assertEquals(DEFAULT_KEY, s1.getAdapterState().getKey()); assertEquals(ClosedState.getInstance().getClass().getName(), s1.getAdapterState().getValue()); s1.setAdapterState(null, ClosedState.getInstance()); assertEquals(DEFAULT_KEY, s1.getAdapterState().getKey()); assertEquals(ClosedState.getInstance().getClass().getName(), s1.getAdapterState().getValue()); try { s1.setAdapterState(DEFAULT_KEY, null); fail("Null Component State"); } catch (IllegalArgumentException expected) { } }
public RootProcessingExceptionHandler() { state = ClosedState.getInstance(); }
public void testToString() { AdapterStateSummary s1 = new AdapterStateSummary(); s1.addChannelState( new KeyValuePair(DEFAULT_KEY, ClosedState.getInstance().getClass().getName())); assertNotNull(s1.toString()); }