WIP: Improve test data creation #112
19
test-data/src/main/java/se/su/dsv/scipro/testdata/BaseData.java
vendored
Normal file
19
test-data/src/main/java/se/su/dsv/scipro/testdata/BaseData.java
vendored
Normal 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();
|
||||||
|
}
|
12
test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java
vendored
Normal file
12
test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java
vendored
Normal 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);
|
||||||
|
}
|
11
test-data/src/main/java/se/su/dsv/scipro/testdata/TestDataPopulator.java
vendored
Normal file
11
test-data/src/main/java/se/su/dsv/scipro/testdata/TestDataPopulator.java
vendored
Normal 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);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user