2 * Copyright (c) 2016 Huawei, Inc. 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.nemo.tool.sandbox;
10 import junit.framework.TestCase;
11 import org.junit.Before;
12 import org.junit.Test;
14 import static org.junit.Assert.*;
15 import asg.cliche.Shell;
16 import asg.cliche.ShellFactory;
18 import java.io.IOException;
19 import java.lang.reflect.Field;
20 import static org.mockito.Mockito.*;
23 * Created by zhangmeng on 2016/1/14.
25 public class EasyCliTest extends TestCase {
26 private EasyCli easyCli;
28 public void setUp() throws Exception {
29 easyCli = new EasyCli("1","2","3");
33 public void testAdd() throws Exception {
38 public void testRun() throws Exception {
39 Field field = EasyCli.class.getDeclaredField("shell");
40 field.setAccessible(true);
42 Shell shell = mock(Shell.class);
44 field.set(easyCli,shell);
45 doNothing().when(shell).commandLoop();
47 verify(shell).commandLoop();