@Test(expected = NullPointerException.class) public void registerFailed2() throws Exception { Application app = new Application(); app.setId("abc"); registry.register(app); }
public Application register(Application app) { Validate.notNull(app, "Application must not be null"); Validate.notNull(app.getId(), "ID must not be null"); Validate.notNull(app.getUrl(), "URL must not be null"); Validate.isTrue(checkUrl(app.getUrl()), "URL is not valid"); return registry.put(app.getId(), app); }
ApplicationRegistry { public Application register(Application app) { Validate.notNull(app, "Application must not be null"); Validate.notNull(app.getId(), "ID must not be null"); Validate.notNull(app.getUrl(), "URL must not be null"); Validate.isTrue(checkUrl(app.getUrl()), "URL is not valid"); return registry.put(app.getId(), app); } }
ApplicationRegistry { public Application register(Application app) { Validate.notNull(app, "Application must not be null"); Validate.notNull(app.getId(), "ID must not be null"); Validate.notNull(app.getUrl(), "URL must not be null"); Validate.isTrue(checkUrl(app.getUrl()), "URL is not valid"); return registry.put(app.getId(), app); }  }
ApplicationRegistry { public Application register(Application app) { Validate.notNull(app, "Application must not be null"); Validate.notNull(app.getId(), "ID must not be null"); Validate.notNull(app.getUrl(), "URL must not be null"); Validate.isTrue(checkUrl(app.getUrl()), "URL is not valid"); return registry.put(app.getId(), app); }  Application register(Application app); boolean isRegistered(String id); List<Application> getApplications(); Application getApplication(String id); }
ApplicationRegistry { public Application register(Application app) { Validate.notNull(app, "Application must not be null"); Validate.notNull(app.getId(), "ID must not be null"); Validate.notNull(app.getUrl(), "URL must not be null"); Validate.isTrue(checkUrl(app.getUrl()), "URL is not valid"); return registry.put(app.getId(), app); }  Application register(Application app); boolean isRegistered(String id); List<Application> getApplications(); Application getApplication(String id);  }