2 * Copyright (c) 2016 Huawei, Inc. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.nemo.tool.sandbox.models;
\r
11 import junit.framework.TestCase;
\r
12 import org.junit.Assert;
\r
13 import org.junit.Before;
\r
14 import org.junit.Test;
\r
15 import static org.mockito.Mockito.*;
\r
16 import static org.junit.Assert.*;
\r
18 import org.opendaylight.nemo.tool.sandbox.utils.Config;
\r
19 import org.opendaylight.nemo.tool.sandbox.utils.HexString;
\r
20 import org.slf4j.Logger;
\r
21 import org.slf4j.LoggerFactory;
\r
23 import java.util.ArrayList;
\r
24 import java.util.Collections;
\r
25 import java.util.List;
\r
27 import java.lang.reflect.Method;
\r
28 import java.lang.reflect.Field;
\r
31 * Created by Thomas Liu on 2016/1/14.
\r
33 public class SwitchTest extends TestCase {
\r
35 private String name;
\r
36 private long dataPathId;
\r
37 private Switch switchTest;
\r
38 private Class class1;
\r
39 private Method method;
\r
43 public void setUp() throws Exception {
\r
44 name = new String("name1");
\r
46 switchTest = new Switch(name,dataPathId);
\r
47 class1 = Switch.class;
\r
48 org.opendaylight.nemo.tool.sandbox.models.Connector connector = new org.opendaylight.nemo.tool.sandbox.models.Connector("connectorname",1);
\r
49 switchTest.addConnectors(connector);
\r
53 public void testGetDataPathId() throws Exception {
\r
54 Assert.assertNotNull(switchTest.getDataPathId());
\r
58 public void testGenerateCommands() throws Exception {
\r
59 method = class1.getDeclaredMethod("generateCommands",new Class[]{});
\r
60 method.setAccessible(true);
\r
61 Assert.assertNotNull(method.invoke(switchTest));
\r
66 public void testToString() throws Exception {
\r
67 Assert.assertNotNull(switchTest.toString());
\r