Chanhee Lee | 9401048 | 2017-01-23 23:06:18 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package org.onosproject.security; |
| 18 | |
| 19 | import static org.junit.Assert.assertEquals; |
| 20 | |
| 21 | import org.junit.Test; |
| 22 | import org.onosproject.security.AppPermission.Type; |
| 23 | |
| 24 | /** |
| 25 | * Test of AppPermission. |
| 26 | */ |
| 27 | public class AppPermissionTest { |
| 28 | |
| 29 | @Test |
| 30 | public void testAppPermissionString() { |
| 31 | String name = "app_read".toUpperCase(); |
| 32 | assertEquals(Type.APP_READ, Type.valueOf(name)); |
| 33 | } |
| 34 | |
| 35 | @Test |
| 36 | public void testAppPermissionStringString() { |
| 37 | String name = "app_read".toUpperCase(); |
| 38 | assertEquals(Type.APP_READ, Type.valueOf(name)); |
| 39 | } |
| 40 | |
| 41 | @Test |
| 42 | public void testAppPermissionType() { |
| 43 | Type type = Type.APP_WRITE; |
| 44 | assertEquals(Type.APP_WRITE, type); |
| 45 | } |
| 46 | |
| 47 | @Test |
| 48 | public void testGetType() { |
| 49 | AppPermission appPermission = new AppPermission(Type.APP_WRITE); |
| 50 | assertEquals(Type.APP_WRITE, appPermission.getType()); |
| 51 | } |
| 52 | |
| 53 | } |