package jmri.util.managers; import javax.annotation.CheckForNull; import javax.annotation.Nonnull; import jmri.InstanceManager; import jmri.Light; import jmri.jmrix.internal.InternalLightManager; import jmri.jmrix.internal.InternalSystemConnectionMemo; /** * This manager always throws an IllegalArgumentException from provide and get methods. * It is used for testing exception handling in tests. * * The class name ends with 'Scaffold' to exclude it from the coverage statistics, * since it is part of the testing infrastructure. */ public class InternalLightManagerThrowExceptionScaffold extends InternalLightManager { public InternalLightManagerThrowExceptionScaffold() { super(InstanceManager.getDefault(InternalSystemConnectionMemo.class)); } /** {@inheritDoc} */ @Override protected Light createNewLight(@Nonnull String systemName, String userName) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @Nonnull public Light provideLight(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @CheckForNull public Light getLight(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @CheckForNull public Light getBySystemName(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @CheckForNull public Light getByUserName(@Nonnull String key) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @Nonnull public Light newLight(@Nonnull String systemName, @CheckForNull String userName) { throw new IllegalArgumentException("Illegal argument"); } }