io.quarkus.test.PropertiesAsset Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-junit5-internal Show documentation
Show all versions of quarkus-junit5-internal Show documentation
A runner for unit tests, intended for testing Quarkus rather than
for end user consumption.
package io.quarkus.test;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import org.jboss.shrinkwrap.api.asset.Asset;
class PropertiesAsset implements Asset {
private final Properties props;
public PropertiesAsset(final Properties props) {
this.props = props;
}
@Override
public InputStream openStream() {
final ByteArrayOutputStream outputStream = new ByteArrayOutputStream(128);
try {
props.store(outputStream, "Unit test Generated Application properties");
} catch (IOException e) {
throw new RuntimeException("Could not write application properties resource", e);
}
return new ByteArrayInputStream(outputStream.toByteArray());
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy