Merge "Add Mycilla code to odlguice"
[odlguice.git] / inject / inject-guice-testutils / src / test / java / org / opendaylight / odlguice / inject / guice / testutils / tests / GuiceRuleForgotAnnotationsModuleTest.java
1 /*
2  * Copyright (c) 2017 Red Hat, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.odlguice.inject.guice.testutils.tests;
9
10 import com.google.inject.AbstractModule;
11 import org.junit.Test;
12 import org.opendaylight.odlguice.inject.guice.testutils.GuiceRule;
13
14 /**
15  * Tests friendly and more helpful than default error message in case
16  * AnnotationsModule was forgotten to be found.
17  *
18  * @author Michael Vorburger.ch
19  */
20 @SuppressWarnings("checkstyle:IllegalThrows")
21 public class GuiceRuleForgotAnnotationsModuleTest {
22
23     // This is intentional, with this it fails expectedly; remove to see how
24     // public @Rule GuiceRule guice = new GuiceRule(TestModule.class);
25
26     @Test(expected = IllegalStateException.class)
27     public void testGuiceWithRule() throws Throwable {
28         new GuiceRule(TestModule.class).apply(null, null, null).evaluate();
29     }
30
31     public static class TestModule extends AbstractModule {
32         @Override
33         protected void configure() {
34         }
35     }
36
37 }