* change.
*/
@Test
public void testCursorPosition() throws Exception
{
final PhysicalPartition ppart = new PhysicalPartition(26, "January");
CheckpointMult cpMult = makeCpMult();
cpMult.setCursorPartition(ppart);
assertEquals(ppart, cpMult.getCursorPartition());
String serialCpMult = cpMult.toString();
CheckpointMult cpMultCopy = new CheckpointMult(serialCpMult);
assertNull(cpMultCopy.getCursorPartition());
// Make sure we are able to decode it, however.
ObjectMapper mapper = new ObjectMapper();
Map<String, String> map = mapper.readValue(
new ByteArrayInputStream(serialCpMult.getBytes(Charset.defaultCharset())), new TypeReference<Map<String, String>>(){});
map.put("NonJsonKey", "Some value");
map.put("cursorPartition", ppart.toJsonString());
ByteArrayOutputStream bs = new ByteArrayOutputStream();
mapper.writeValue(bs, map);
cpMultCopy = new CheckpointMult(bs.toString());
assertEquals(cpMultCopy.getCursorPartition(), ppart);