WIP: Improve test data creation #112

Draft
ansv7779 wants to merge 4 commits from test-data-improvements into develop
3 changed files with 42 additions and 0 deletions
Showing only changes of commit b02cc1db21 - Show all commits

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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);
}