### Question:
BehaviorRegistry implements InitializingBean { public BehaviorRegistry register(final Behavior behavior) { Assert.notNull(behavior, "Behavior must not be null"); String name = behavior.name(); Assert.isTrue(!behaviorByName.containsKey(name), () -> "Behaviour with name " + name + " already registered"); behaviorByName.put(name, behavior); return this; }  @Override void afterPropertiesSet(); Behavior findByName(final String name); BehaviorRegistry register(final Behavior behavior); Collection<Behavior> getBehaviors();  }### Answer:
@Test void should_throw_on_duplicate_name() { final LogBehavior logBehavior = new LogBehavior(); registry.register(logBehavior); Assertions.assertThrows(IllegalArgumentException.class, () -> registry.register(logBehavior)); }