TestBasicClientCookie.java (httpcomponents-client-4.5.6-src) | : | TestBasicClientCookie.java (httpcomponents-client-4.5.7-src) | ||
---|---|---|---|---|
skipping to change at line 78 | skipping to change at line 78 | |||
Assert.assertEquals(orig.getAttribute("attrib"), clone.getAttribute("att rib")); | Assert.assertEquals(orig.getAttribute("attrib"), clone.getAttribute("att rib")); | |||
} | } | |||
@Test | @Test | |||
public void testSerialization() throws Exception { | public void testSerialization() throws Exception { | |||
final BasicClientCookie orig = new BasicClientCookie("name", "value"); | final BasicClientCookie orig = new BasicClientCookie("name", "value"); | |||
orig.setDomain("domain"); | orig.setDomain("domain"); | |||
orig.setPath("/"); | orig.setPath("/"); | |||
orig.setAttribute("attrib", "stuff"); | orig.setAttribute("attrib", "stuff"); | |||
final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream(); | final ByteArrayOutputStream outbuffer = new ByteArrayOutputStream(); | |||
final ObjectOutputStream outstream = new ObjectOutputStream(outbuffer); | final ObjectOutputStream outStream = new ObjectOutputStream(outbuffer); | |||
outstream.writeObject(orig); | outStream.writeObject(orig); | |||
outstream.close(); | outStream.close(); | |||
final byte[] raw = outbuffer.toByteArray(); | final byte[] raw = outbuffer.toByteArray(); | |||
final ByteArrayInputStream inbuffer = new ByteArrayInputStream(raw); | final ByteArrayInputStream inBuffer = new ByteArrayInputStream(raw); | |||
final ObjectInputStream instream = new ObjectInputStream(inbuffer); | final ObjectInputStream inStream = new ObjectInputStream(inBuffer); | |||
final BasicClientCookie clone = (BasicClientCookie) instream.readObject( | final BasicClientCookie clone = (BasicClientCookie) inStream.readObject( | |||
); | ); | |||
Assert.assertEquals(orig.getName(), clone.getName()); | Assert.assertEquals(orig.getName(), clone.getName()); | |||
Assert.assertEquals(orig.getValue(), clone.getValue()); | Assert.assertEquals(orig.getValue(), clone.getValue()); | |||
Assert.assertEquals(orig.getDomain(), clone.getDomain()); | Assert.assertEquals(orig.getDomain(), clone.getDomain()); | |||
Assert.assertEquals(orig.getPath(), clone.getPath()); | Assert.assertEquals(orig.getPath(), clone.getPath()); | |||
Assert.assertEquals(orig.getAttribute("attrib"), clone.getAttribute("att rib")); | Assert.assertEquals(orig.getAttribute("attrib"), clone.getAttribute("att rib")); | |||
} | } | |||
} | } | |||
End of changes. 2 change blocks. | ||||
7 lines changed or deleted | 7 lines changed or added |