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

io.cucumber.core.plugin.TestSourceReadResource Maven / Gradle / Ivy

There is a newer version: 7.20.1
Show newest version
package io.cucumber.core.plugin;

import io.cucumber.core.resource.Resource;
import io.cucumber.plugin.event.TestSourceRead;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.URI;

import static java.nio.charset.StandardCharsets.UTF_8;

final class TestSourceReadResource implements Resource {

    private final TestSourceRead event;

    TestSourceReadResource(TestSourceRead event) {
        this.event = event;
    }

    @Override
    public URI getUri() {
        return event.getUri();
    }

    @Override
    public InputStream getInputStream() {
        return new ByteArrayInputStream(event.getSource().getBytes(UTF_8));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy