
eu.drus.jpa.unit.mongodb.DataSetLoaderProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jpa-unit-mongodb Show documentation
Show all versions of jpa-unit-mongodb Show documentation
JUnit extension for simple testing of JPA entities and components
The newest version!
package eu.drus.jpa.unit.mongodb;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import org.bson.Document;
import eu.drus.jpa.unit.spi.DataSetFormat.LoaderProvider;
import eu.drus.jpa.unit.spi.DataSetLoader;
import eu.drus.jpa.unit.spi.UnsupportedDataSetFormatException;
public class DataSetLoaderProvider implements LoaderProvider {
@Override
public DataSetLoader xmlLoader() {
throw new UnsupportedDataSetFormatException("XML data sets are not supportred for MongoDB");
}
@Override
public DataSetLoader yamlLoader() {
throw new UnsupportedDataSetFormatException("YAML data sets are not supportred for MongoDB");
}
@Override
public DataSetLoader jsonLoader() {
return (final File path) -> Document.parse(new String(Files.readAllBytes(path.toPath()), StandardCharsets.UTF_8));
}
@Override
public DataSetLoader csvLoader() {
throw new UnsupportedDataSetFormatException("CSV data sets are not supportred for MongoDB");
}
@Override
public DataSetLoader xlsLoader() {
throw new UnsupportedDataSetFormatException("XSL data sets are not supportred for MongoDB");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy