@Test public void testSetRole() { PeerCard peer = new PeerCard(PeerRole.COORDINATOR, "Karaf", "Java"); try { peer.setRole(null); fail("Expected NullPointerException because trying to assign null value"); } catch (Exception ex) { assertTrue("Exception thrown but is not the right one", ex instanceof NullPointerException); } }
public void setRole(PeerRole role) { if (role == null) throw new NullPointerException("Cannot assign null as Role"); this.role = role; }
PeerCard { public void setRole(PeerRole role) { if (role == null) throw new NullPointerException("Cannot assign null as Role"); this.role = role; } }
PeerCard { public void setRole(PeerRole role) { if (role == null) throw new NullPointerException("Cannot assign null as Role"); this.role = role; } PeerCard(PeerRole role, String containerUnit, String platformUnit);  PeerCard();  PeerCard(String ID, PeerRole role);  PeerCard(String strSerialization); }
PeerCard { public void setRole(PeerRole role) { if (role == null) throw new NullPointerException("Cannot assign null as Role"); this.role = role; } PeerCard(PeerRole role, String containerUnit, String platformUnit);  PeerCard();  PeerCard(String ID, PeerRole role);  PeerCard(String strSerialization); String getPeerID(); PeerRole getRole(); void setRole(PeerRole role); boolean isCoordinator(); String toString(); int hashCode(); boolean equals(Object o); String getPLATFORM_UNIT(); void setPLATFORM_UNIT(String pLATFORM_UNIT); String getCONTAINER_UNIT(); void setCONTAINER_UNIT(String cONTAINER_UNIT); String getOS(); void setOS(String oS); URI toURI(); }
PeerCard { public void setRole(PeerRole role) { if (role == null) throw new NullPointerException("Cannot assign null as Role"); this.role = role; } PeerCard(PeerRole role, String containerUnit, String platformUnit);  PeerCard();  PeerCard(String ID, PeerRole role);  PeerCard(String strSerialization); String getPeerID(); PeerRole getRole(); void setRole(PeerRole role); boolean isCoordinator(); String toString(); int hashCode(); boolean equals(Object o); String getPLATFORM_UNIT(); void setPLATFORM_UNIT(String pLATFORM_UNIT); String getCONTAINER_UNIT(); void setCONTAINER_UNIT(String cONTAINER_UNIT); String getOS(); void setOS(String oS); URI toURI();  }