@Test public void testValues() throws Exception { String resolvedPath = "/_resources/test"; String nativeLinkKey = "Attachment:38"; String[] params = new String[3]; params[0] = "param1"; params[1] = "param2"; params[2] = "param3"; CreateAttachmentUrlInstruction instruction = new CreateAttachmentUrlInstruction(); instruction.setNativeLinkKey(nativeLinkKey); instruction.setParams(params); instruction.setRequestedMenuItemKey("1"); String result = instruction.serialize(); CreateAttachmentUrlInstruction instruction2 = new CreateAttachmentUrlInstruction(); instruction2.deserialize(result); assertTrue(instruction.equals(instruction2)); assertTrue(Arrays.equals(instruction.getParams(), instruction2.getParams())); assertEquals(instruction.getNativeLinkKey(), instruction2.getNativeLinkKey()); assertEquals(instruction.getRequestedMenuItemKey(), instruction2.getRequestedMenuItemKey()); }
@Test public void testEquals() throws IOException { CreateAttachmentUrlInstruction i1 = new CreateAttachmentUrlInstruction(); PostProcessInstruction i2 = null; assertTrue(!i1.equals(i2)); i2 = new CreateAttachmentUrlInstruction(); assertTrue(i1.equals(i2)); CreateAttachmentUrlInstruction i3 = new CreateAttachmentUrlInstruction(); i1.setNativeLinkKey("Dummy"); i3.setNativeLinkKey("Dummy2"); assertTrue(!i1.equals(i3)); i3.setNativeLinkKey("Dummy"); assertTrue(i1.equals(i3)); }