diff options
Diffstat (limited to 'docproc/src/test/java/com/yahoo/docproc/NotAcceptingNewProcessingsTestCase.java')
-rw-r--r-- | docproc/src/test/java/com/yahoo/docproc/NotAcceptingNewProcessingsTestCase.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/docproc/src/test/java/com/yahoo/docproc/NotAcceptingNewProcessingsTestCase.java b/docproc/src/test/java/com/yahoo/docproc/NotAcceptingNewProcessingsTestCase.java new file mode 100644 index 00000000000..9e5f7a43c74 --- /dev/null +++ b/docproc/src/test/java/com/yahoo/docproc/NotAcceptingNewProcessingsTestCase.java @@ -0,0 +1,27 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.docproc; + +/** + * @author <a href="mailto:einarmr@yahoo-inc.com">Einar M R Rosenvinge</a> + */ +public class NotAcceptingNewProcessingsTestCase extends junit.framework.TestCase { + + public void testNotAccepting() { + DocprocService service = new DocprocService("habla"); + service.setCallStack(new CallStack()); + service.setInService(true); + + service.process(new Processing()); + assertEquals(1, service.getQueueSize()); + + service.setAcceptingNewProcessings(false); + + try { + service.process(new Processing()); + fail("Should have gotten IllegalStateException here"); + } catch (IllegalStateException ise) { + //ok! + } + assertEquals(1, service.getQueueSize()); + } +} |