package eu.dnetlib.wds.collector.plugins;

import com.google.gson.Gson;
import eu.dnetlib.rmi.data.CollectorServiceException;
import org.junit.Test;

import java.util.List;

public class CMRDatasourcePluginTest {


    @Test
    public void testParsing() throws CollectorServiceException {
        CMRDatasourcePlugin plugin = new CMRDatasourcePlugin();


        List<String> strings = plugin.generateListOfDatasource();

        System.out.println(strings.size());

        final Gson g = new Gson();
        boolean present = strings.stream().map(it -> g.fromJson(it, GenericDatasource.class)).anyMatch(it -> it.getExtrafields().get("archive_center").equals("NZ/NIWA"));
        System.out.println("present = " + present);


    }
}
