All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.arextest.diff.handler.FillResultSync Maven / Gradle / Ivy

There is a newer version: 0.2.15
Show newest version
package com.arextest.diff.handler;

import com.arextest.diff.factory.TaskThreadFactory;
import com.arextest.diff.model.parse.MsgObjCombination;
import com.arextest.diff.utils.JacksonHelperUtil;
import com.fasterxml.jackson.core.JsonProcessingException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Future;

public class FillResultSync {

  public List> fillResult(MsgObjCombination response) {
    List> list = new ArrayList<>();
    Future submit1 = TaskThreadFactory.jsonObjectThreadPool.submit(
        () -> getJsonString(response.getBaseObj()));

    Future submit2 = TaskThreadFactory.jsonObjectThreadPool.submit(
        () -> getJsonString(response.getTestObj()));

    list.add(submit1);
    list.add(submit2);
    return list;
  }

  private String getJsonString(Object obj) throws JsonProcessingException {
    return obj == null
        ? null
        : JacksonHelperUtil.objectMapper.writeValueAsString(obj);
  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy