blob: 9f2011c84e7e67f31f8b591d3f2da1fbe3518c48 [file] [log] [blame]
Chanhee Lee94010482017-01-23 23:06:18 -08001/*
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
17package org.onosproject.security;
18
19import static org.junit.Assert.assertEquals;
20
21import org.junit.Test;
22import org.onosproject.security.AppPermission.Type;
23
24/**
25 * Test of AppPermission.
26 */
27public 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}