aboutsummaryrefslogtreecommitdiffstats
path: root/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java')
-rw-r--r--jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java53
1 files changed, 53 insertions, 0 deletions
diff --git a/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java
new file mode 100644
index 00000000000..1351e717015
--- /dev/null
+++ b/jdisc_core/src/test/java/com/yahoo/jdisc/application/ApplicationNotReadyTestCase.java
@@ -0,0 +1,53 @@
+// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+package com.yahoo.jdisc.application;
+
+import com.google.inject.Inject;
+import com.google.inject.ProvisionException;
+import com.yahoo.jdisc.test.TestDriver;
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+
+/**
+ * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
+ */
+public class ApplicationNotReadyTestCase {
+
+ @Test
+ public void requireThatExceptionIsThrown() {
+ try {
+ TestDriver.newInjectedApplicationInstanceWithoutOsgi(MyApplication.class);
+ fail();
+ } catch (ProvisionException e) {
+ Throwable t = e.getCause();
+ assertNotNull(t);
+ assertTrue(t instanceof ApplicationNotReadyException);
+ }
+ }
+
+ private static class MyApplication implements Application {
+
+ @Inject
+ MyApplication(ContainerActivator activator) {
+ activator.activateContainer(activator.newContainerBuilder());
+ }
+
+ @Override
+ public void start() {
+
+ }
+
+ @Override
+ public void stop() {
+
+ }
+
+ @Override
+ public void destroy() {
+
+ }
+ }
+}