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

com.griddynamics.qa.datapool.serialization.yamlers.LocalDateYamler Maven / Gradle / Ivy

Go to download

Test Data Pool tool is intended to mitigate risks of running automated tests against multiple unstable “FullDB” environments having unpredictable set of data.

The newest version!
package com.griddynamics.qa.datapool.serialization.yamlers;

import com.griddynamics.qa.datapool.serialization.Marshaller;
import com.griddynamics.qa.datapool.serialization.Yamler;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.ScalarNode;
import org.yaml.snakeyaml.nodes.Tag;

import java.time.LocalDate;

/**
 * @author Alexey Lyanguzov.
 */
public class LocalDateYamler extends Yamler {
    public LocalDateYamler() {
        super(new Tag("!LocalDate"), LocalDate.class);
    }

    @Override
    public Object construct(Node node) {
        return LocalDate.parse(((ScalarNode) node).getValue());
    }

    @Override
    public Node representData(Object data) {
        return Marshaller.REPRESENTER.representScalar(getTag(), data.toString());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy