package jmri.util.managers; import javax.annotation.Nonnull; import javax.annotation.CheckForNull; import jmri.InstanceManager; import jmri.Turnout; import jmri.jmrix.internal.InternalSystemConnectionMemo; import jmri.jmrix.internal.InternalTurnoutManager; /** * 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 TurnoutManagerThrowExceptionScaffold extends InternalTurnoutManager { public TurnoutManagerThrowExceptionScaffold() { super(InstanceManager.getDefault(InternalSystemConnectionMemo.class)); } /** {@inheritDoc} */ @Override protected Turnout createNewTurnout(@Nonnull String systemName, String userName) throws IllegalArgumentException { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @Nonnull public Turnout provideTurnout(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override public Turnout getTurnout(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override public Turnout getBySystemName(@Nonnull String name) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override public Turnout getByUserName(@Nonnull String key) { throw new IllegalArgumentException("Illegal argument"); } /** {@inheritDoc} */ @Override @Nonnull public Turnout newTurnout(@Nonnull String systemName, @CheckForNull String userName) { throw new IllegalArgumentException("Illegal argument"); } }