@Test(expected = IllegalArgumentException.class) public void registerFailed_null() { registry.register(null); }
public Mono<InstanceId> register(Registration registration) { Assert.notNull(registration, "'registration' must not be null"); InstanceId id = generator.generateId(registration); Assert.notNull(id, "'id' must not be null"); return repository.compute(id, (key, instance) -> { if (instance == null) { instance = Instance.create(key); } return Mono.just(instance.register(registration)); }).map(Instance::getId); }
InstanceRegistry { public Mono<InstanceId> register(Registration registration) { Assert.notNull(registration, "'registration' must not be null"); InstanceId id = generator.generateId(registration); Assert.notNull(id, "'id' must not be null"); return repository.compute(id, (key, instance) -> { if (instance == null) { instance = Instance.create(key); } return Mono.just(instance.register(registration)); }).map(Instance::getId); } }
InstanceRegistry { public Mono<InstanceId> register(Registration registration) { Assert.notNull(registration, "'registration' must not be null"); InstanceId id = generator.generateId(registration); Assert.notNull(id, "'id' must not be null"); return repository.compute(id, (key, instance) -> { if (instance == null) { instance = Instance.create(key); } return Mono.just(instance.register(registration)); }).map(Instance::getId); } InstanceRegistry(InstanceRepository repository, InstanceIdGenerator generator); }
InstanceRegistry { public Mono<InstanceId> register(Registration registration) { Assert.notNull(registration, "'registration' must not be null"); InstanceId id = generator.generateId(registration); Assert.notNull(id, "'id' must not be null"); return repository.compute(id, (key, instance) -> { if (instance == null) { instance = Instance.create(key); } return Mono.just(instance.register(registration)); }).map(Instance::getId); } InstanceRegistry(InstanceRepository repository, InstanceIdGenerator generator); Mono<InstanceId> register(Registration registration); Flux<Instance> getInstances(); Flux<Instance> getInstances(String name); Mono<Instance> getInstance(InstanceId id); Mono<InstanceId> deregister(InstanceId id); }
InstanceRegistry { public Mono<InstanceId> register(Registration registration) { Assert.notNull(registration, "'registration' must not be null"); InstanceId id = generator.generateId(registration); Assert.notNull(id, "'id' must not be null"); return repository.compute(id, (key, instance) -> { if (instance == null) { instance = Instance.create(key); } return Mono.just(instance.register(registration)); }).map(Instance::getId); } InstanceRegistry(InstanceRepository repository, InstanceIdGenerator generator); Mono<InstanceId> register(Registration registration); Flux<Instance> getInstances(); Flux<Instance> getInstances(String name); Mono<Instance> getInstance(InstanceId id); Mono<InstanceId> deregister(InstanceId id);  }