@TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "!SerializationGolden", args = {}) public void testSerialization_Compatibility() throws Exception { UnresolvedPermission up = new UnresolvedPermission("java.security.SecurityPermission", "a.b.c", "actions", null); assertEquals("java.security.SecurityPermission", up.getUnresolvedType()); assertEquals("a.b.c", up.getUnresolvedName()); assertEquals("actions", up.getUnresolvedActions()); assertNull(up.getUnresolvedCerts()); SerializationTest.verifyGolden( this, up, new SerializableAssert() { public void assertDeserialized(Serializable orig, Serializable ser) { UnresolvedPermission deserializedUp = (UnresolvedPermission) ser; assertEquals("java.security.SecurityPermission", deserializedUp.getUnresolvedType()); assertEquals("a.b.c", deserializedUp.getUnresolvedName()); assertEquals("actions", deserializedUp.getUnresolvedActions()); assertNull(deserializedUp.getUnresolvedCerts()); } }); }
@TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "getUnresolvedName", args = {}) public void testGetUnresolvedName() { UnresolvedPermission up1 = new UnresolvedPermission("type1", "name1!@#$%^&&* )(", "action1 @#$%^&*", null); UnresolvedPermission up2 = null; assertEquals("name1!@#$%^&&* )(", up1.getUnresolvedName()); try { up2.getUnresolvedName(); fail("NullPointerException expected"); } catch (NullPointerException e) { // expected } }
@TestTargetNew( level = TestLevel.COMPLETE, notes = "", method = "!SerializationSelf", args = {}) public void testSerialization() throws Exception { UnresolvedPermission up = new UnresolvedPermission("java.security.SecurityPermission", "a.b.c", "actions", null); assertEquals("java.security.SecurityPermission", up.getUnresolvedType()); assertEquals("a.b.c", up.getUnresolvedName()); assertEquals("actions", up.getUnresolvedActions()); assertNull(up.getUnresolvedCerts()); UnresolvedPermission deserializedUp = (UnresolvedPermission) SerializationTester.getDeserilizedObject(up); assertEquals("java.security.SecurityPermission", deserializedUp.getUnresolvedType()); assertEquals("a.b.c", deserializedUp.getUnresolvedName()); assertEquals("actions", deserializedUp.getUnresolvedActions()); assertNull(deserializedUp.getUnresolvedCerts()); }