Enforce modernize in openflowjava-extension-eric
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / device / initialization / DeviceInitializerProviderTest.java
1 /*
2  * Copyright (c) 2017 Pantheon Technologies s.r.o. 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.openflowplugin.impl.device.initialization;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
13
14 import java.util.Optional;
15 import org.junit.Before;
16 import org.junit.Test;
17 import org.junit.runner.RunWith;
18 import org.mockito.Mock;
19 import org.mockito.junit.MockitoJUnitRunner;
20 import org.opendaylight.openflowplugin.api.OFConstants;
21
22 @RunWith(MockitoJUnitRunner.class)
23 public class DeviceInitializerProviderTest {
24     @Mock
25     private AbstractDeviceInitializer abstractDeviceInitializer;
26     private DeviceInitializerProvider provider;
27
28     @Before
29     public void setUp() {
30         provider = new DeviceInitializerProvider();
31     }
32
33     @Test
34     public void register() {
35         provider.register(OFConstants.OFP_VERSION_1_3, abstractDeviceInitializer);
36         final Optional<AbstractDeviceInitializer> lookup = provider.lookup(OFConstants.OFP_VERSION_1_3);
37         assertTrue(lookup.isPresent());
38         assertEquals(abstractDeviceInitializer, lookup.get());
39     }
40
41     @Test
42     public void lookup() {
43         assertFalse(provider.lookup(OFConstants.OFP_VERSION_1_0).isPresent());
44     }
45
46 }