public void test_removeOpenVpnStateListener_does_not_accept_null() throws RemoteException { try { wrapper.removeOpenVpnStateListener(null); fail("NullPointerException expected"); } catch (NullPointerException e) { assertEquals("listener is null in removeOpenVpnStateListener", e.getMessage()); } }
@Test public void cannotRemoveFormatAttributeWithNullName() { try { Library.newBuilder().removeFormatAttribute(null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getKey("nullFormat")); } }
@Test public void cannotAddNullFormatAttribute() { try { Library.newBuilder().addFormatAttribute("foo", null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getKey("nullAttribute")); } }
@Test public void cannotRemoveNullKeyword() { try { Library.newBuilder().removeKeyword(null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getKey("nullName")); } }
@Test public void cannotInitiateWithNullProcessor() { try { ProcessorChain.startWith(null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getMessage("processing.nullProcessor")); } }
@Test public void cannotChainWithNullProcessor() { @SuppressWarnings("unchecked") final Processor<MessageProvider, MessageProvider> p = mock(Processor.class); try { ProcessorChain.startWith(p).chainWith(null); fail("No exception thrown!!"); } catch (NullPointerException e) { assertEquals(e.getMessage(), BUNDLE.getMessage("processing.nullProcessor")); } }
public RelevantCommunityAnalyser(IIdentity linkedEntity, String linkType) { if (linkType.equals("CSS")) this.linkedCss = linkedEntity; // else // this.linkedDomain = linkedEntity; proximityHistory = new ArrayList<ProximityRecord>(); recordedMetadata = new HashMap<String, String>(); refusals = new ArrayList<ICisProposal>(); try { List<CtxIdentifier> ctxMetadata = userContextBroker.lookup(CtxModelType.ATTRIBUTE, "hasCLM").get(); for (int i = 0; i < ctxMetadata.size(); i++) { CtxAttribute thisMetadata = (CtxAttribute) userContextBroker.retrieve(ctxMetadata.get(i)).get(); String thisMetadataValue = thisMetadata.getStringValue(); recordedMetadata.put( thisMetadataValue.split("---")[0].split("CIS ID: ")[1], thisMetadataValue.split("---")[1]); } } catch (InterruptedException e) { e.printStackTrace(); } catch (ExecutionException e) { e.printStackTrace(); } catch (CtxException e) { e.printStackTrace(); } catch (NullPointerException e) { e.printStackTrace(); } // new ProximityRecordingThread().start(); }