diff options
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractServerProviderTestCase.java')
-rw-r--r-- | jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractServerProviderTestCase.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractServerProviderTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractServerProviderTestCase.java new file mode 100644 index 00000000000..c6230e928b7 --- /dev/null +++ b/jdisc_core/src/test/java/com/yahoo/jdisc/service/AbstractServerProviderTestCase.java @@ -0,0 +1,51 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.jdisc.service; + +import com.google.inject.Inject; +import com.yahoo.jdisc.application.ContainerBuilder; +import com.yahoo.jdisc.test.TestDriver; +import org.junit.Test; + +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + + +/** + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class AbstractServerProviderTestCase { + + @Test + public void requireThatAbstractClassIsAServerProvider() { + TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); + assertTrue(ServerProvider.class.isInstance(new MyServerProvider(driver))); + assertTrue(driver.close()); + } + + @Test + public void requireThatAccessorsWork() { + TestDriver driver = TestDriver.newSimpleApplicationInstanceWithoutOsgi(); + ContainerBuilder builder = driver.newContainerBuilder(); + MyServerProvider server = builder.getInstance(MyServerProvider.class); + assertNotNull(server.container()); + assertTrue(driver.close()); + } + + private static class MyServerProvider extends AbstractServerProvider { + + @Inject + public MyServerProvider(CurrentContainer container) { + super(container); + } + + @Override + public void start() { + + } + + @Override + public void close() { + + } + } +} |