/** * Get the configured DataSetFactory for the given method * * @param annotationClass The class of the annotation, i.e. DataSet.class or ExpectedDataSet.class * @param testMethod The method for which we need the configured DataSetFactory * @param testClass The class that is looked for class-level annotations * @return The configured DataSetFactory */ @SuppressWarnings("unchecked") protected DataSetFactory getDataSetFactory(Class<? extends Annotation> annotationClass, Method testMethod, Class<?> testClass) { Class<? extends DataSetFactory> dataSetFactoryClass = getMethodOrClassLevelAnnotationProperty(annotationClass, "factory", DataSetFactory.class, testMethod, testClass); dataSetFactoryClass = (Class<? extends DataSetFactory>) getClassValueReplaceDefault(annotationClass, "factory", dataSetFactoryClass, defaultAnnotationPropertyValues, DataSetFactory.class); return getDataSetFactory(dataSetFactoryClass); }
/** * Creates the DbUnit dataset operation for loading a data set for the given method. If a value for loadStrategy is found on an * annotation, this class is used, otherwise the configured default class will be used. * * @param testMethod The method, not null * @param testClass The test class, not null * @return The DbUnit operation, not null */ @SuppressWarnings({ "unchecked" }) protected DataSetLoadStrategy getDataSetLoadStrategy(Method testMethod, Class<?> testClass, DataSet dataSet) { Class<? extends DataSetLoadStrategy> dataSetOperationClass = dataSet.loadStrategy(); dataSetOperationClass = (Class<? extends DataSetLoadStrategy>) getClassValueReplaceDefault(DataSet.class, "loadStrategy", dataSetOperationClass, defaultAnnotationPropertyValues, DataSetLoadStrategy.class); return createInstanceOfType(dataSetOperationClass, false); }