@Test void testRegisterExceptionResponseGenerator() { ExceptionResponseGenerator responseGenerator = mock(ExceptionResponseGenerator.class); when(responseGenerator.getType()).thenReturn(PROBLEM); exceptionResponseGeneratorRegistryImpl.registerExceptionResponseGenerator(responseGenerator); assertEquals( responseGenerator, exceptionResponseGeneratorRegistryImpl.getExceptionResponseGenerator(PROBLEM)); }
@Override public void registerExceptionResponseGenerator( ExceptionResponseGenerator exceptionResponseGenerator) { ExceptionResponseType type = exceptionResponseGenerator.getType(); if (responseGeneratorMap.containsKey(type)) { throw new IllegalArgumentException( format("Duplicate exception response generator [%s]", type)); } responseGeneratorMap.put(type, exceptionResponseGenerator); }
ExceptionResponseGeneratorRegistryImpl implements ExceptionResponseGeneratorRegistry { @Override public void registerExceptionResponseGenerator( ExceptionResponseGenerator exceptionResponseGenerator) { ExceptionResponseType type = exceptionResponseGenerator.getType(); if (responseGeneratorMap.containsKey(type)) { throw new IllegalArgumentException( format("Duplicate exception response generator [%s]", type)); } responseGeneratorMap.put(type, exceptionResponseGenerator); } }
ExceptionResponseGeneratorRegistryImpl implements ExceptionResponseGeneratorRegistry { @Override public void registerExceptionResponseGenerator( ExceptionResponseGenerator exceptionResponseGenerator) { ExceptionResponseType type = exceptionResponseGenerator.getType(); if (responseGeneratorMap.containsKey(type)) { throw new IllegalArgumentException( format("Duplicate exception response generator [%s]", type)); } responseGeneratorMap.put(type, exceptionResponseGenerator); } ExceptionResponseGeneratorRegistryImpl(); }
ExceptionResponseGeneratorRegistryImpl implements ExceptionResponseGeneratorRegistry { @Override public void registerExceptionResponseGenerator( ExceptionResponseGenerator exceptionResponseGenerator) { ExceptionResponseType type = exceptionResponseGenerator.getType(); if (responseGeneratorMap.containsKey(type)) { throw new IllegalArgumentException( format("Duplicate exception response generator [%s]", type)); } responseGeneratorMap.put(type, exceptionResponseGenerator); } ExceptionResponseGeneratorRegistryImpl(); @Override void registerExceptionResponseGenerator(
      ExceptionResponseGenerator exceptionResponseGenerator); @Override ExceptionResponseGenerator getExceptionResponseGenerator(ExceptionResponseType type); }
ExceptionResponseGeneratorRegistryImpl implements ExceptionResponseGeneratorRegistry { @Override public void registerExceptionResponseGenerator( ExceptionResponseGenerator exceptionResponseGenerator) { ExceptionResponseType type = exceptionResponseGenerator.getType(); if (responseGeneratorMap.containsKey(type)) { throw new IllegalArgumentException( format("Duplicate exception response generator [%s]", type)); } responseGeneratorMap.put(type, exceptionResponseGenerator); } ExceptionResponseGeneratorRegistryImpl(); @Override void registerExceptionResponseGenerator(
      ExceptionResponseGenerator exceptionResponseGenerator); @Override ExceptionResponseGenerator getExceptionResponseGenerator(ExceptionResponseType type);  }