File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed
main/java/org/owasp/wrongsecrets
test/java/org/owasp/wrongsecrets Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,11 @@ public List<Difficulty> difficulties() {
9696 }
9797
9898 public boolean isFirstChallenge (ChallengeDefinition challengeDefinition ) {
99- return challengeDefinition .equals (definitions .challenges ().get ( 0 ));
99+ return challengeDefinition .equals (definitions .challenges ().getFirst ( ));
100100 }
101101
102102 public boolean isLastChallenge (ChallengeDefinition challengeDefinition ) {
103- return challengeDefinition .equals (definitions .challenges ().get ( definitions . challenges (). size () - 1 ));
103+ return challengeDefinition .equals (definitions .challenges ().getLast ( ));
104104 }
105105
106106 public List <ChallengeDefinition > getChallengeDefinitions () {
Original file line number Diff line number Diff line change @@ -36,23 +36,23 @@ class ChallengesControllerCTFClientModeTest {
3636
3737 @ Test
3838 void shouldNotSpoilWhenInCTFMode () throws Exception {
39- var randomChallenge = challenges .getChallengeDefinitions ().get ( 0 );
39+ var randomChallenge = challenges .getChallengeDefinitions ().getFirst ( );
4040 mvc .perform (get ("/spoil/%s" .formatted (randomChallenge .name ().shortName ())))
4141 .andExpect (status ().isOk ())
4242 .andExpect (content ().string (containsString ("Spoils are disabled in CTF mode" )));
4343 }
4444
4545 @ Test
4646 void shouldNotSpoilWhenInCTFModeEvenWhenChallengeUnsupported () throws Exception {
47- var firstChallenge = challenges .getChallengeDefinitions ().get ( 0 );
47+ var firstChallenge = challenges .getChallengeDefinitions ().getFirst ( );
4848 mvc .perform (get ("/spoil/%s" .formatted (firstChallenge .name ().shortName ())))
4949 .andExpect (status ().isOk ())
5050 .andExpect (content ().string (containsString ("Spoils are disabled in CTF mode" )));
5151 }
5252
5353 @ Test
5454 void challenge0SshouldSShowTheAddressRightAnswersNeedToBeSubmittedTo () throws Exception {
55- var firstChallenge = challenges .getChallengeDefinitions ().get ( 0 );
55+ var firstChallenge = challenges .getChallengeDefinitions ().getFirst ( );
5656 mvc .perform (get ("/challenge/%s" .formatted (firstChallenge .name ().shortName ())))
5757 .andExpect (status ().isOk ())
5858 .andExpect (content ().string (containsString ("https://www.google.nl" )));
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ class ChallengesControllerCTFModeWithPresetCloudValuesTest {
4242
4343 @ Test
4444 void shouldNotSpoilWhenInCTFMode () throws Exception {
45- var firstChallenge = challenges .getChallengeDefinitions ().get ( 0 );
45+ var firstChallenge = challenges .getChallengeDefinitions ().getFirst ( );
4646 mvc .perform (get ("/spoil/%s" .formatted (firstChallenge .name ().shortName ())))
4747 .andExpect (status ().isOk ())
4848 .andExpect (content ().string (containsString ("Spoils are disabled in CTF mode" )));
@@ -51,7 +51,7 @@ void shouldNotSpoilWhenInCTFMode() throws Exception {
5151 @ Test
5252 void shouldShowFlagWhenRespondingWithSuccessInCTFModeChallenge9 () throws Exception {
5353 var challenge9Definition = challenges .findByShortName ("challenge-9" ).orElseThrow ();
54- var challenge9 = challenges .getChallenge (challenge9Definition ).get ( 0 );
54+ var challenge9 = challenges .getChallenge (challenge9Definition ).getFirst ( );
5555 var spoil = challenge9 .spoiler ().solution ();
5656 mvc .perform (
5757 post ("/challenge/%s" .formatted (challenge9Definition .name ().shortName ()))
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ void navigatePreviousWhenOnFirstChallenge() {
1616 var navigation =
1717 new Navigator (
1818 challengeDefinitionsConfiguration .challenges (),
19- challengeDefinitionsConfiguration .challenges ().get ( 0 ));
19+ challengeDefinitionsConfiguration .challenges ().getFirst ( ));
2020
2121 assertThat (navigation .previous ()).isEmpty ();
2222 }
@@ -26,14 +26,14 @@ void navigateNextWhenOnLastChallenge() {
2626 var navigation =
2727 new Navigator (
2828 challengeDefinitionsConfiguration .challenges (),
29- challengeDefinitionsConfiguration .challenges ().get ( challengeDefinitionsConfiguration . challenges (). size () - 1 ));
29+ challengeDefinitionsConfiguration .challenges ().getLast ( ));
3030
3131 assertThat (navigation .next ()).isEmpty ();
3232 }
3333
3434 @ Test
3535 void navigatePreviousAndNextOnSecondChallenge () {
36- var first = challengeDefinitionsConfiguration .challenges ().get ( 0 );
36+ var first = challengeDefinitionsConfiguration .challenges ().getFirst ( );
3737 var second = challengeDefinitionsConfiguration .challenges ().get (1 );
3838 var third = challengeDefinitionsConfiguration .challenges ().get (2 );
3939
You can’t perform that action at this time.
0 commit comments