### Question:
CustomXYURLGenerator implements XYURLGenerator, Cloneable,
        PublicCloneable, Serializable { public void addURLSeries(List<String> urls) { List<String> listToAdd = null; if (urls != null) { listToAdd = new java.util.ArrayList<String>(urls); } this.urlSeries.add(listToAdd); } CustomXYURLGenerator(); int getListCount(); int getURLCount(int list); String getURL(int series, int item); @Override String generateURL(XYDataset dataset, int series, int item); void addURLSeries(List<String> urls); @Override boolean equals(Object obj); @Override Object clone();  }### Answer:
@Test public void testSerialization() throws IOException, ClassNotFoundException { List<String> u1 = new java.util.ArrayList<String>(); u1.add("URL A1"); u1.add("URL A2"); u1.add("URL A3"); List<String> u2 = new java.util.ArrayList<String>(); u2.add("URL B1"); u2.add("URL B2"); u2.add("URL B3"); CustomXYURLGenerator g1 = new CustomXYURLGenerator(); g1.addURLSeries(u1); g1.addURLSeries(u2); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(g1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); CustomXYURLGenerator g2 = (CustomXYURLGenerator) in.readObject(); in.close(); assertEquals(g1, g2); }
@Test public void testAddURLSeries() { CustomXYURLGenerator g1 = new CustomXYURLGenerator(); g1.addURLSeries(null); assertEquals(1, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); List<String> list1 = new java.util.ArrayList<String>(); list1.add("URL1"); g1.addURLSeries(list1); assertEquals(2, g1.getListCount()); assertEquals(0, g1.getURLCount(0)); assertEquals(1, g1.getURLCount(1)); assertEquals("URL1", g1.getURL(1, 0)); list1.clear(); assertEquals("URL1", g1.getURL(1, 0)); }