Infrastructure for creating individual populators for specific test cases.

This commit is contained in:
Andreas Svanberg 2025-02-17 15:32:38 +01:00
parent 2af932291c
commit 4276dc15b1
3 changed files with 42 additions and 0 deletions
test-data/src/main/java/se/su/dsv/scipro/testdata

@ -0,0 +1,19 @@
package se.su.dsv.scipro.testdata;
import se.su.dsv.scipro.system.ProjectType;
/// All the base test data that can be re-used in different test cases.
///
/// **Do not modify any of this data.** There are many
/// [TestDataPopulator]s that rely on this data to be in a specific state.
///
/// In addition to the data that is available here there is also much additional
/// data that has been created;
///
/// - A grading report template for each [ProjectType]
///
public interface BaseData {
ProjectType bachelor();
ProjectType magister();
ProjectType master();
}

@ -0,0 +1,12 @@
package se.su.dsv.scipro.testdata;
import se.su.dsv.scipro.system.User;
/**
* A factory to help with repetitive tasks when populating test data.
*/
public interface Factory {
User createAuthor(String firstName);
User createSupervisor(String firstName);
User createReviewer(String firstName);
}

@ -0,0 +1,11 @@
package se.su.dsv.scipro.testdata;
public interface TestDataPopulator {
/**
* Add test data to the system to help with testing a specific feature.
*
* @param baseData the base data already populated
* @param factory helper object to make repetitive tasks easier (such as creating users)
*/
void populate(BaseData baseData, Factory factory);
}