@TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "getActions", args = {}) public void testGetActions() { UnresolvedPermission up1 = new UnresolvedPermission("type1", "name1", "action1", null); UnresolvedPermission up2 = null; assertEquals("", up1.getActions()); try { up2.getActions(); fail("NullPointerException expected"); } catch (NullPointerException e) { // expected } }
/** * Creates an Object with given name, type, action, certificates. Empty or null type is not * allowed - exception should be thrown. */ @TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "UnresolvedPermission", args = { java.lang.String.class, java.lang.String.class, java.lang.String.class, java.security.cert.Certificate[].class }) public void testCtor() { String type = "laskjhlsdk 2345346"; String name = "^%#UHVKU^%V 887y"; String action = "JHB ^%(*&T klj3h4"; UnresolvedPermission up = new UnresolvedPermission(type, name, action, null); assertEquals(type, up.getName()); assertEquals("", up.getActions()); assertEquals("(unresolved " + type + " " + name + " " + action + ")", up.toString()); up = new UnresolvedPermission(type, null, null, null); assertEquals(type, up.getName()); assertEquals("", up.getActions()); assertEquals("(unresolved " + type + " null null)", up.toString()); up = new UnresolvedPermission(type, "", "", new java.security.cert.Certificate[0]); assertEquals(type, up.getName()); assertEquals("", up.getActions()); assertEquals("(unresolved " + type + " )", up.toString()); try { new UnresolvedPermission(null, name, action, null); fail("No expected NullPointerException"); } catch (NullPointerException ok) { } // Regression for HARMONY-733 up = new UnresolvedPermission("", "name", "action", null); assertEquals("", up.getName()); }