@Test public void testSerializationWithEmptyList() { ArrayList<ProducerJob> jobs = new ArrayList<>(); String json = ProducerJob.serialize(jobs); List<ProducerJob> deserialized = SimpleProducerJob.deserialize(json); Assert.assertTrue(deserialized.isEmpty()); }
public static String serialize(Collection<ProducerJob> jobs) { Collection<ProducerJob> producerJobs = new ArrayList<>(jobs.size()); for (ProducerJob job : jobs) { producerJobs.add(new SimpleProducerJob(job)); } Gson gson = gsonBuilder.create(); return gson.toJson(producerJobs); }
ProducerJob { public static String serialize(Collection<ProducerJob> jobs) { Collection<ProducerJob> producerJobs = new ArrayList<>(jobs.size()); for (ProducerJob job : jobs) { producerJobs.add(new SimpleProducerJob(job)); } Gson gson = gsonBuilder.create(); return gson.toJson(producerJobs); } }
ProducerJob { public static String serialize(Collection<ProducerJob> jobs) { Collection<ProducerJob> producerJobs = new ArrayList<>(jobs.size()); for (ProducerJob job : jobs) { producerJobs.add(new SimpleProducerJob(job)); } Gson gson = gsonBuilder.create(); return gson.toJson(producerJobs); }  }
ProducerJob { public static String serialize(Collection<ProducerJob> jobs) { Collection<ProducerJob> producerJobs = new ArrayList<>(jobs.size()); for (ProducerJob job : jobs) { producerJobs.add(new SimpleProducerJob(job)); } Gson gson = gsonBuilder.create(); return gson.toJson(producerJobs); }  abstract String getPage(); abstract String getStartDate(); abstract String getEndDate(); abstract GoogleWebmasterFilter.FilterOperator getOperator(); abstract int getPagesSize(); List<? extends ProducerJob> partitionJobs(); static String serialize(Collection<ProducerJob> jobs); }
ProducerJob { public static String serialize(Collection<ProducerJob> jobs) { Collection<ProducerJob> producerJobs = new ArrayList<>(jobs.size()); for (ProducerJob job : jobs) { producerJobs.add(new SimpleProducerJob(job)); } Gson gson = gsonBuilder.create(); return gson.toJson(producerJobs); }  abstract String getPage(); abstract String getStartDate(); abstract String getEndDate(); abstract GoogleWebmasterFilter.FilterOperator getOperator(); abstract int getPagesSize(); List<? extends ProducerJob> partitionJobs(); static String serialize(Collection<ProducerJob> jobs);  }