3 * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.
7 * This program and the accompanying materials are made available under the
9 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
11 * and is available at http://www.eclipse.org/legal/epl-v10.html
14 package org.opendaylight.nemo.user.transactionmanager;
16 import static org.mockito.Matchers.any;
17 import static org.mockito.Mockito.mock;
18 import static org.mockito.Mockito.verify;
19 import static org.mockito.Mockito.when;
20 import junit.framework.TestCase;
22 import org.junit.Assert;
23 import org.junit.Before;
24 import org.junit.Test;
25 import org.opendaylight.nemo.user.tenantmanager.AAA;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.BeginTransactionInput;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.user.rev151010.UserInstance;
30 * Created by zhangmeng on 2015/11/20.
32 public class TransactionBeginTest extends TestCase {
33 private TransactionBegin transactionBegin;
35 public void setUp() throws Exception {
36 transactionBegin = new TransactionBegin();
40 public void testTransactionbegin() throws Exception {
41 AAA aaa = mock(AAA.class);
42 BeginTransactionInput input = mock(BeginTransactionInput.class);
43 when(aaa.checkUser(any(UserInstance.class))).thenReturn(new String("test"));
44 String flag = transactionBegin.transactionbegin(aaa,input);
45 verify(aaa).checkUser(any(UserInstance.class));
46 Assert.assertEquals("test",flag);