2021-02-05 19:18:05 +01:00
|
|
|
|
|
|
|
package eu.dnetlib.dhp.collector.worker.utils;
|
|
|
|
|
2021-02-06 20:12:00 +01:00
|
|
|
import static eu.dnetlib.dhp.utils.DHPUtils.*;
|
|
|
|
|
2021-02-05 19:18:05 +01:00
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import org.junit.jupiter.api.Assertions;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
2021-02-06 20:12:00 +01:00
|
|
|
import eu.dnetlib.dhp.collection.worker.CollectorPluginReport;
|
2021-02-05 19:18:05 +01:00
|
|
|
|
|
|
|
public class CollectorPluginReportTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void testSerialize() throws IOException {
|
|
|
|
CollectorPluginReport r1 = new CollectorPluginReport();
|
|
|
|
r1.put("a", "b");
|
|
|
|
r1.setSuccess(true);
|
|
|
|
|
2021-02-06 20:12:00 +01:00
|
|
|
String s = MAPPER.writeValueAsString(r1);
|
2021-02-05 19:18:05 +01:00
|
|
|
|
|
|
|
Assertions.assertNotNull(s);
|
|
|
|
|
2021-02-06 20:12:00 +01:00
|
|
|
CollectorPluginReport r2 = MAPPER.readValue(s, CollectorPluginReport.class);
|
2021-02-05 19:18:05 +01:00
|
|
|
|
|
|
|
Assertions.assertTrue(r2.isSuccess(), "should be true");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|