Change all the package names from infrautils to odlguice
[odlguice.git] / inject / inject-guice-testutils / src / test / java / org / opendaylight / odlguice / inject / guice / testutils / tests / ExampleGuiceRuleTest.java
1 /*
2  * Copyright (c) 2016 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 static org.junit.Assert.assertTrue;
11
12 import javax.inject.Inject;
13 import org.junit.Rule;
14 import org.junit.Test;
15 import org.opendaylight.odlguice.inject.guice.testutils.AbstractGuiceJsr250Module;
16 import org.opendaylight.odlguice.inject.guice.testutils.GuiceRule;
17
18 /**
19  * Example Guice Test using the {@link GuiceRule} & {@link AbstractGuiceJsr250Module}.
20  *
21  * @author Michael Vorburger
22  */
23 public class ExampleGuiceRuleTest {
24     @Rule public GuiceRule guice = new GuiceRule(TestModule.class);
25
26     @Inject SomeInterfaceWithPostConstruct someService;
27
28     @Test
29     public void testGuiceWithRule() {
30         assertTrue(someService.isInit());
31     }
32
33     public static class TestModule extends AbstractGuiceJsr250Module {
34         @Override
35         protected void configureBindings() {
36             bind(SomeInterfaceWithPostConstruct.class).to(SomeClassWithPostConstruct.class);
37         }
38     }
39 }