2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.impl.device.initialization;
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12 import static org.junit.Assert.assertTrue;
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;
22 @RunWith(MockitoJUnitRunner.class)
23 public class DeviceInitializerProviderTest {
25 private AbstractDeviceInitializer abstractDeviceInitializer;
26 private DeviceInitializerProvider provider;
30 provider = new DeviceInitializerProvider();
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.orElseThrow());
42 public void lookup() {
43 assertFalse(provider.lookup(OFConstants.OFP_VERSION_1_0).isPresent());