@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 = "getUnresolvedType", args = {}) public void testGetUnresolvedType() { UnresolvedPermission up1 = new UnresolvedPermission("type1@#$%^&* )(", "name1", "action1", null); UnresolvedPermission up2 = null; assertEquals("type1@#$%^&* )(", up1.getUnresolvedType()); try { up2.getUnresolvedType(); 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()); }