@Test (expected = IllegalArgumentException.class) public void addNullEndpoint() { final ServiceData data = new ServiceData(); data.addEndpoint(null); }
public boolean addEndpoint(final Endpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint can not be null"); } synchronized (syncObject) { if (endpoints.containsKey(endpoint.getName())) { return false; } endpoints.put(endpoint.getName(), endpoint); } return true; }
ServiceData { public boolean addEndpoint(final Endpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint can not be null"); } synchronized (syncObject) { if (endpoints.containsKey(endpoint.getName())) { return false; } endpoints.put(endpoint.getName(), endpoint); } return true; } }
ServiceData { public boolean addEndpoint(final Endpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint can not be null"); } synchronized (syncObject) { if (endpoints.containsKey(endpoint.getName())) { return false; } endpoints.put(endpoint.getName(), endpoint); } return true; } ServiceData();   ServiceData(final List<Endpoint> endpointList); }
ServiceData { public boolean addEndpoint(final Endpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint can not be null"); } synchronized (syncObject) { if (endpoints.containsKey(endpoint.getName())) { return false; } endpoints.put(endpoint.getName(), endpoint); } return true; } ServiceData();   ServiceData(final List<Endpoint> endpointList); Endpoint getEndpoint(final String name); boolean addEndpoint(final Endpoint endpoint); boolean removeEndpoint(final Endpoint endpoint); }
ServiceData { public boolean addEndpoint(final Endpoint endpoint) { if (endpoint == null) { throw new IllegalArgumentException("Endpoint can not be null"); } synchronized (syncObject) { if (endpoints.containsKey(endpoint.getName())) { return false; } endpoints.put(endpoint.getName(), endpoint); } return true; } ServiceData();   ServiceData(final List<Endpoint> endpointList); Endpoint getEndpoint(final String name); boolean addEndpoint(final Endpoint endpoint); boolean removeEndpoint(final Endpoint endpoint);  }