Fix incorrect package names
[nemo.git] / nemo-impl / src / test / java / org / opendaylight / nemo / user / transactionmanager / TransactionBeginTest.java
1 /*\r
2  * Copyright (c) 2015 Huawei, Inc. and others. All rights reserved.\r
3  *\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
7  */\r
8 package org.opendaylight.nemo.user.transactionmanager;\r
9 \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 org.opendaylight.nemo.user.tenantmanager.AAA;\r
15 import org.opendaylight.nemo.user.transactionmanager.TransactionBegin;\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.intent.rev151010.BeginTransactionInput;\r
17 import static org.junit.Assert.*;\r
18 import static org.mockito.Mockito.*;\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.nemo.common.rev151010.UserId;\r
20 /**\r
21  * Created by zhangmeng on 2015/12/15.\r
22  */\r
23 public class TransactionBeginTest extends TestCase {\r
24     private AAA aaa;\r
25     private BeginTransactionInput input;\r
26     private TransactionBegin transactionBegin;\r
27     @Override\r
28     @Before\r
29     public void setUp() throws Exception {\r
30         aaa = mock(AAA.class);\r
31         input =  mock(BeginTransactionInput.class);\r
32 \r
33         transactionBegin = new TransactionBegin();\r
34     }\r
35 \r
36     @Test\r
37     public void testTransactionbegin() throws Exception {\r
38         String result;\r
39         UserId userId = mock(UserId.class);\r
40 \r
41         when(aaa.checkUser(any(UserId.class))).thenReturn(new String("test"));\r
42         when(input.getUserId()).thenReturn(userId);\r
43 \r
44         result = transactionBegin.transactionbegin(aaa,input);\r
45         Assert.assertTrue(result.equals("test"));\r
46     }\r
47 }