Search in sources :

Example 1 with DataFileServiceBean

use of edu.harvard.iq.dataverse.DataFileServiceBean in project dataverse by IQSS.

the class UpdateDatasetThumbnailCommandTest method setUp.

@Before
public void setUp() {
    dataset = new Dataset();
    testEngine = new TestDataverseEngine(new TestCommandContext() {

        @Override
        public DataFileServiceBean files() {
            return new DataFileServiceBean() {

                @Override
                public DataFile find(Object object) {
                    if (object == unfindableFile) {
                        return null;
                    } else if (object == thumbnailUnexpectedlyAbsent) {
                        return new DataFile();
                    } else {
                        return null;
                    }
                }
            };
        }

        @Override
        public DatasetServiceBean datasets() {
            return new DatasetServiceBean() {

                @Override
                public Dataset setDatasetFileAsThumbnail(Dataset dataset, DataFile datasetFileThumbnailToSwitchTo) {
                    return dataset;
                }
            };
        }

        @Override
        public SystemConfig systemConfig() {
            return new SystemConfig() {

                @Override
                public String getDataverseSiteUrl() {
                    return "https://dataverse.example.edu";
                }
            };
        }
    });
}
Also used : DataFile(edu.harvard.iq.dataverse.DataFile) SystemConfig(edu.harvard.iq.dataverse.util.SystemConfig) TestCommandContext(edu.harvard.iq.dataverse.engine.TestCommandContext) DataFileServiceBean(edu.harvard.iq.dataverse.DataFileServiceBean) Dataset(edu.harvard.iq.dataverse.Dataset) DatasetServiceBean(edu.harvard.iq.dataverse.DatasetServiceBean) TestDataverseEngine(edu.harvard.iq.dataverse.engine.TestDataverseEngine) Before(org.junit.Before)

Aggregations

DataFile (edu.harvard.iq.dataverse.DataFile)1 DataFileServiceBean (edu.harvard.iq.dataverse.DataFileServiceBean)1 Dataset (edu.harvard.iq.dataverse.Dataset)1 DatasetServiceBean (edu.harvard.iq.dataverse.DatasetServiceBean)1 TestCommandContext (edu.harvard.iq.dataverse.engine.TestCommandContext)1 TestDataverseEngine (edu.harvard.iq.dataverse.engine.TestDataverseEngine)1 SystemConfig (edu.harvard.iq.dataverse.util.SystemConfig)1 Before (org.junit.Before)1