2121import java .time .LocalDateTime ;
2222import java .util .ArrayList ;
2323import java .util .List ;
24- import keeper .project .homepage .ctf .dto .CtfChallengeCategoryDto ;
2524import keeper .project .homepage .ctf .entity .CtfChallengeCategoryEntity ;
25+ import keeper .project .homepage .ctf .entity .CtfChallengeCategoryEntity .CtfChallengeCategory ;
2626import keeper .project .homepage .ctf .entity .CtfChallengeEntity ;
2727import keeper .project .homepage .ctf .entity .CtfContestEntity ;
2828import keeper .project .homepage .ctf .entity .CtfFlagEntity ;
@@ -58,17 +58,14 @@ public void getProblemListSuccess() throws Exception {
5858 CtfContestEntity contest = generateCtfContest (adminEntity , true );
5959
6060 Long score = 1000L ;
61- List <CtfChallengeCategoryDto > category = new ArrayList <>();
62- category .add (CtfChallengeCategoryDto .toDto (CtfChallengeCategoryEntity .builder ()
63- .id (MISC .getId ())
64- .name (MISC .getName ())
65- .build ()));
61+ List <CtfChallengeCategory > categories = new ArrayList <>();
62+ categories .add (MISC );
6663 CtfChallengeEntity dynamicChallenge = generateCtfChallenge (
67- contest , DYNAMIC , category , score , true );
64+ contest , DYNAMIC , categories , score , true );
6865 CtfChallengeEntity standardChallenge = generateCtfChallenge (
69- contest , STANDARD , category , score , true );
66+ contest , STANDARD , categories , score , true );
7067 CtfChallengeEntity notSolvable = generateCtfChallenge (
71- contest , DYNAMIC , category , score , false );
68+ contest , DYNAMIC , categories , score , false );
7269
7370 CtfTeamEntity team = generateCtfTeam (contest , userEntity , 0L );
7471
@@ -87,8 +84,8 @@ public void getProblemListSuccess() throws Exception {
8784 .andExpect (jsonPath ("$.list[0].content" ).doesNotExist ())
8885 .andExpect (jsonPath ("$.list[0].contestId" )
8986 .value (dynamicChallenge .getCtfContestEntity ().getId ()))
90- .andExpect (jsonPath ("$.list[0].category [0].id" )
91- .value (category .get (0 ).getId ()))
87+ .andExpect (jsonPath ("$.list[0].categories [0].id" )
88+ .value (categories .get (0 ).getId ()))
9289 .andExpect (jsonPath ("$.list[0].type.id" ).doesNotExist ())
9390 .andExpect (jsonPath ("$.list[0].isSolvable" ).doesNotExist ())
9491 .andExpect (jsonPath ("$.list[0].score" ).value (dynamicChallenge .getScore ()))
@@ -99,8 +96,8 @@ public void getProblemListSuccess() throws Exception {
9996 .andExpect (jsonPath ("$.list[1].content" ).doesNotExist ())
10097 .andExpect (jsonPath ("$.list[1].contestId" )
10198 .value (standardChallenge .getCtfContestEntity ().getId ()))
102- .andExpect (jsonPath ("$.list[1].category [0].id" )
103- .value (category .get (0 ).getId ()))
99+ .andExpect (jsonPath ("$.list[1].categories [0].id" )
100+ .value (categories .get (0 ).getId ()))
104101 .andExpect (jsonPath ("$.list[1].type.id" ).doesNotExist ())
105102 .andExpect (jsonPath ("$.list[1].isSolvable" ).doesNotExist ())
106103 .andExpect (jsonPath ("$.list[1].score" ).value (standardChallenge .getScore ()))
@@ -124,17 +121,14 @@ public void getProblemListSuccess_lastTryTimeNullable() throws Exception {
124121 CtfContestEntity contest = generateCtfContest (adminEntity , true );
125122
126123 Long score = 1000L ;
127- List <CtfChallengeCategoryDto > category = new ArrayList <>();
124+ List <CtfChallengeCategory > categories = new ArrayList <>();
128125
129- category .add (CtfChallengeCategoryDto .toDto (CtfChallengeCategoryEntity .builder ()
130- .id (FORENSIC .getId ())
131- .name (FORENSIC .getName ())
132- .build ()));
126+ categories .add (FORENSIC );
133127
134128 CtfChallengeEntity dynamicChallenge = generateCtfChallenge (
135- contest , DYNAMIC , category , score , true );
129+ contest , DYNAMIC , categories , score , true );
136130 CtfChallengeEntity standardChallenge = generateCtfChallenge (
137- contest , STANDARD , category , score , true );
131+ contest , STANDARD , categories , score , true );
138132
139133 CtfTeamEntity team = generateCtfTeam (contest , userEntity , 0L );
140134
@@ -162,14 +156,11 @@ public void checkFlagSuccess() throws Exception {
162156 Long maxScore = 1234L ;
163157 Long minScore = 567L ;
164158
165- List <CtfChallengeCategoryDto > category = new ArrayList <>();
166- category .add (CtfChallengeCategoryDto .toDto (CtfChallengeCategoryEntity .builder ()
167- .id (FORENSIC .getId ())
168- .name (FORENSIC .getName ())
169- .build ()));
159+ List <CtfChallengeCategory > categories = new ArrayList <>();
160+ categories .add (FORENSIC );
170161
171162 CtfChallengeEntity dynamicChallenge = generateCtfChallenge (
172- contest , DYNAMIC , category , score , true );
163+ contest , DYNAMIC , categories , score , true );
173164 generateDynamicChallengeInfo (dynamicChallenge , maxScore , minScore );
174165
175166 CtfTeamEntity team = generateCtfTeam (contest , userEntity , 0L );
@@ -213,13 +204,10 @@ public void checkFlagFailedByNotEnoughSubmitCount() throws Exception {
213204 Long score = 1000L ;
214205 Long maxScore = 1234L ;
215206 Long minScore = 567L ;
216- List <CtfChallengeCategoryDto > category = new ArrayList <>();
217- category .add (CtfChallengeCategoryDto .toDto (CtfChallengeCategoryEntity .builder ()
218- .id (FORENSIC .getId ())
219- .name (FORENSIC .getName ())
220- .build ()));
207+ List <CtfChallengeCategory > categories = new ArrayList <>();
208+ categories .add (FORENSIC );
221209 CtfChallengeEntity dynamicChallenge = generateCtfChallenge (
222- contest , DYNAMIC , category , score , true );
210+ contest , DYNAMIC , categories , score , true );
223211 generateDynamicChallengeInfo (dynamicChallenge , maxScore , minScore );
224212 CtfTeamEntity team = generateCtfTeam (contest , userEntity , 0L );
225213 CtfFlagEntity flag = generateCtfFlag (team , dynamicChallenge , false , 0L );
@@ -244,13 +232,10 @@ public void getProblemDetailSuccess() throws Exception {
244232 CtfContestEntity contest = generateCtfContest (adminEntity , true );
245233
246234 Long score = 1000L ;
247- List <CtfChallengeCategoryDto > category = new ArrayList <>();
248- category .add (CtfChallengeCategoryDto .toDto (CtfChallengeCategoryEntity .builder ()
249- .id (FORENSIC .getId ())
250- .name (FORENSIC .getName ())
251- .build ()));
235+ List <CtfChallengeCategory > categories = new ArrayList <>();
236+ categories .add (FORENSIC );
252237 CtfChallengeEntity dynamicChallenge = generateCtfChallenge (
253- contest , DYNAMIC , category , score , true );
238+ contest , DYNAMIC , categories , score , true );
254239 generateFileInChallenge (dynamicChallenge );
255240
256241 CtfTeamEntity team = generateCtfTeam (contest , userEntity , 0L );
@@ -267,8 +252,8 @@ public void getProblemDetailSuccess() throws Exception {
267252 .andExpect (jsonPath ("$.data.content" ).value (dynamicChallenge .getDescription ()))
268253 .andExpect (jsonPath ("$.data.contestId" )
269254 .value (dynamicChallenge .getCtfContestEntity ().getId ()))
270- .andExpect (jsonPath ("$.data.category [0].id" )
271- .value (category .get (0 ).getId ()))
255+ .andExpect (jsonPath ("$.data.categories [0].id" )
256+ .value (categories .get (0 ).getId ()))
272257 .andExpect (jsonPath ("$.data.type.id" ).doesNotExist ())
273258 .andExpect (jsonPath ("$.data.isSolvable" ).doesNotExist ())
274259 .andExpect (
0 commit comments