@@ -0,0 +1,2992 @@
+/*%0A *  Licensed to the Apache Software Foundation (ASF) under one or more%0A *  contributor license agreements.  See the NOTICE file distributed with%0A *  this work for additional information regarding copyright ownership.%0A *  The ASF licenses this file to You under the Apache License, Version 2.0%0A *  (the %22License%22); you may not use this file except in compliance with%0A *  the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *  Unless required by applicable law or agreed to in writing, software%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  See the License for the specific language governing permissions and%0A *  limitations under the License.%0A */%0A%0Apackage org.apache.harmony.security.tests.java.security;%0A%0Aimport java.security.AllPermission;%0Aimport java.security.SecurityPermission;%0Aimport java.security.UnresolvedPermission;%0A%0Aimport junit.framework.TestCase;%0A%0A/**%0A * Tests for %3Ccode%3EUnresolvedPermission%3C/code%3E class fields and methods%0A * %0A */%0A%0Apublic class UnresolvedPermissionTest extends TestCase %7B%0A    %0A    /**%0A     * Creates an Object with given name, type, action, certificaties. %0A     * Empty or null type is not allowed - exception should be thrown.%0A     */%0A    public void testCtor()%0A    %7B%0A        String type = %22laskjhlsdk 2345346%22;%0A        String name = %22%5E%25#UHVKU%5E%25V  887y%22;%0A        String action = %22JHB %5E%25(*&T klj3h4%22;%0A        UnresolvedPermission up = new UnresolvedPermission(type, name, action, null);%0A        assertEquals(type, up.getName());%0A        assertEquals(%22%22, up.getActions());%0A        assertEquals(%22(unresolved %22 + type + %22 %22 + name + %22 %22 + action + %22)%22, up.toString());%0A        %0A        up = new UnresolvedPermission(type, null, null, null);%0A        assertEquals(type, up.getName());%0A        assertEquals(%22%22, up.getActions());%0A        assertEquals(%22(unresolved %22 + type + %22 null null)%22, up.toString());%0A        %0A        up = new UnresolvedPermission(type, %22%22, %22%22, new java.security.cert.Certificate%5B0%5D);%0A        assertEquals(type, up.getName());%0A        assertEquals(%22%22, up.getActions());%0A        assertEquals(%22(unresolved %22 + type + %22  )%22, up.toString());%0A        %0A        try %7B%0A            new UnresolvedPermission(null, name, action, null);%0A            fail(%22exception is not thrown on null type%22);%0A        %7D%0A        catch (Exception ok) %7B%7D%0A%0A        //Regression for HARMONY-733%0A        up = new UnresolvedPermission(%22%22, %22name%22, %22action%22, null);%0A        assertEquals(%22%22, up.getName());%0A    %7D%0A    %0A    /** %0A     * UnresolvedPermission never implies any other permission.%0A     */%0A    public void testImplies()%0A    %7B%0A        UnresolvedPermission up = new UnresolvedPermission(%22java.security.SecurityPermission%22, %22a.b.c%22, null, null);%0A        assertFalse(up.implies(up));%0A        assertFalse(up.implies(new AllPermission()));%0A        assertFalse(up.implies(new SecurityPermission(%22a.b.c%22)));%0A    %7D%0A%7D%0A

Fix regression test for HARMONY-733