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

com.kazurayam.materialstore.map.IdentityMapper Maven / Gradle / Ivy

Go to download

A Java/Groovy API to store objects (Screenshots, HTML, JSON, XML) collected during End-to-end testings empowered by diffing and reporting tools

There is a newer version: 0.18.4
Show newest version
package com.kazurayam.materialstore.map;

import com.kazurayam.materialstore.core.JobName;
import com.kazurayam.materialstore.core.JobTimestamp;
import com.kazurayam.materialstore.core.Jobber;
import com.kazurayam.materialstore.core.Material;
import com.kazurayam.materialstore.core.MaterialstoreException;
import com.kazurayam.materialstore.core.Store;

import java.util.Objects;

public final class IdentityMapper implements Mapper {
    public IdentityMapper() {
    }

    @Override
    public void setStore(Store store) {
        this.store = store;
    }

    @Override
    public void setMappingListener(MappingListener listener) {
        this.listener = listener;
    }

    @Override
    public void map(Material material) throws MaterialstoreException {
        Objects.requireNonNull(material);
        assert store != null;
        assert listener != null;
        //
        JobName jobName = material.getJobName();
        JobTimestamp jobTimestamp = material.getJobTimestamp();
        Jobber jobber = store.getJobber(jobName, jobTimestamp);
        //
        listener.onMapped(jobber.read(material), material.getFileType(), material.getMetadata());
    }

    private Store store;
    private MappingListener listener;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy