2 * Copyright (c) 2016 CableLabs 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.unimgr.cli;
10 import static org.junit.Assert.assertEquals;
11 import static org.mockito.Mockito.mock;
13 import org.junit.Before;
14 import org.junit.Test;
15 import org.mockito.Mock;
16 import org.mockito.Mockito;
17 import org.powermock.api.support.membermodification.MemberModifier;
18 import org.powermock.reflect.Whitebox;
20 public class UniRemoveShellCommandTest {
21 private final String ipAddress = "192.168.1.1";
22 private final UnimgrConsoleProviderTest provider = new UnimgrConsoleProviderTest();
24 @Mock UniRemoveShellCommand uniRemoveShellCommand;
27 public void setUp() throws IllegalArgumentException, IllegalAccessException{
28 uniRemoveShellCommand = mock(UniRemoveShellCommand.class, Mockito.CALLS_REAL_METHODS);
29 MemberModifier.field(UniRemoveShellCommand.class, "provider").set(uniRemoveShellCommand, provider);
30 MemberModifier.field(UniRemoveShellCommand.class, "ipAddress").set(uniRemoveShellCommand, ipAddress);
34 * Test method for {@link org.opendaylight.unimgr.cli.UniRemoveShellCommand#doExecute()}.
38 public void testDoExecute() throws Exception {
39 final String success = "Uni successfully removed";
40 final String error = "Error removing Uni";
41 Object answer = Whitebox.invokeMethod(uniRemoveShellCommand, "doExecute");
42 assertEquals(success, answer);
43 answer = Whitebox.invokeMethod(uniRemoveShellCommand, "doExecute");
44 assertEquals(error, answer);