From 167a73fb0108cb2d269c86a6f7acd07552d2501c Mon Sep 17 00:00:00 2001 From: Andreas Svanberg <andreass@dsv.su.se> Date: Tue, 25 Feb 2025 11:48:17 +0100 Subject: [PATCH] Add documentation to test data Factory methods --- .../se/su/dsv/scipro/testdata/Factory.java | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java b/test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java index 4a9ae43a77..fc4c0910f1 100644 --- a/test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java +++ b/test-data/src/main/java/se/su/dsv/scipro/testdata/Factory.java @@ -1,12 +1,46 @@ package se.su.dsv.scipro.testdata; +import se.su.dsv.scipro.security.auth.roles.Roles; import se.su.dsv.scipro.system.User; /** * A factory to help with repetitive tasks when populating test data. */ public interface Factory { + /** + * Creates a user with the given first name and last name "Student". + * The user is given the role {@link Roles#AUTHOR}. + * <p> + * A username is created of the form {@code <first_name>@example.com} that + * can be used to log in. + */ User createAuthor(String firstName); + + /** + * Creates a user with the given first name and last name "Employee". + * <p> + * The user is given the role {@link Roles#SUPERVISOR}, {@link Roles#REVIEWER}, + * and {@link Roles#EXAMINER}. + * <p> + * The user gets a default research area, unit, and language. It is also + * marked as {@link User#setActiveAsSupervisor(boolean) an active supervisor}. + * <p> + * A username is created of the form {@code <first_name>@example.com} that + * can be used to log in. + */ User createSupervisor(String firstName); + + /** + * Creates a user with the given first name and last name "Employee". + * <p> + * The user is given the role {@link Roles#SUPERVISOR}, {@link Roles#REVIEWER}, + * and {@link Roles#EXAMINER}. + * <p> + * The user gets a default research area, unit, and language. It is also + * marked as {@link User#setActiveAsSupervisor(boolean) an active supervisor}. + * <p> + * A username is created of the form {@code <first_name>@example.com} that + * can be used to log in. + */ User createReviewer(String firstName); }