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
9 package org.opendaylight.nemo.tool.sandbox.models;
\r
10 import junit.framework.TestCase;
\r
11 import org.junit.Assert;
\r
12 import org.junit.Before;
\r
13 import org.junit.Test;
\r
14 import static org.mockito.Mockito.*;
\r
15 import static org.junit.Assert.*;
\r
17 import org.opendaylight.nemo.tool.sandbox.CmdExecutor;
\r
18 import org.opendaylight.nemo.tool.sandbox.models.Connector;
\r
20 import org.junit.runner.RunWith;
\r
21 import org.powermock.api.mockito.PowerMockito;
\r
22 import org.powermock.api.support.membermodification.MemberMatcher;
\r
23 import org.powermock.api.support.membermodification.MemberModifier;
\r
24 import org.powermock.core.classloader.annotations.PrepareForTest;
\r
25 import org.powermock.modules.junit4.PowerMockRunner;
\r
28 * Created by Thomas Liu on 2016/1/14.
\r
30 @RunWith(PowerMockRunner.class)
\r
31 @PrepareForTest({CmdExecutor.class})
\r
32 public class LinkTest extends TestCase {
\r
34 private Connector srcInterface;
\r
35 private Connector dstInterface;
\r
36 private Link likeTest;
\r
39 public void setUp() throws Exception {
\r
40 srcInterface = new Connector("src",1);
\r
41 dstInterface = new Connector("dst",2);
\r
42 likeTest = new Link(srcInterface,dstInterface);
\r
47 public void testGetSrcConnector() throws Exception {
\r
48 Assert.assertNotNull(likeTest.getSrcConnector());
\r
52 public void testGetDstConnector() throws Exception {
\r
53 Assert.assertNotNull(likeTest.getDstConnector());
\r
57 public void testInstall() throws Exception {
\r
58 PowerMockito.mockStatic(CmdExecutor.class);
\r
59 PowerMockito.when(CmdExecutor.sshExecute(any(String.class))).thenReturn("null");
\r
64 public void testUninstall() throws Exception {
\r
65 PowerMockito.mockStatic(CmdExecutor.class);
\r
66 PowerMockito.when(CmdExecutor.sshExecute(any(String.class))).thenReturn("null");
\r
67 likeTest.uninstall();
\r
71 public void testEquals() throws Exception {
\r
72 Assert.assertNotNull(likeTest.equals(this));
\r
76 public void testHashCode() throws Exception {
\r
77 Assert.assertNotNull(likeTest.hashCode());
\r
81 public void testToString() throws Exception {
\r
82 Assert.assertNotNull(likeTest.toString());
\r