Skip to content

Commit

Permalink
#44 front end JavaScript library with key obfuscated - rename challen…
Browse files Browse the repository at this point in the history
…ge to 16
  • Loading branch information
drnow4u committed Mar 31, 2022
1 parent a973b1a commit 1ec4543
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Now you can try to find the secrets by means of solving the challenge offered at
- [localhost:8080/challenge/12](http://localhost:8080/challenge/12)
- [localhost:8080/challenge/13](http://localhost:8080/challenge/13)
- [localhost:8080/challenge/14](http://localhost:8080/challenge/14)
- [localhost:8080/challenge/16](http://localhost:8080/challenge/16)

Note that these challenges are still very basic, and so are their explanations. Feel free to file a PR to make them look better ;-).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@

@Slf4j
@Component
@Order(15)
public class Challenge15 extends Challenge {
@Order(16)
public class Challenge16 extends Challenge {

private final String dockerMountPath;

public Challenge15(ScoreCard scoreCard, @Value("${challengedockermtpath}") String dockerMountPath) {
public Challenge16(ScoreCard scoreCard, @Value("${challengedockermtpath}") String dockerMountPath) {
super(scoreCard);
this.dockerMountPath = dockerMountPath;
}
Expand All @@ -33,7 +33,7 @@ public Spoiler spoiler() {

@Override
public boolean answerCorrect(String answer) {
log.info("challenge 15, actualdata: {}, answer: {}", getActualData(), answer);
log.info("challenge 16, actualdata: {}, answer: {}", getActualData(), answer);
return getActualData().equals(answer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
import java.nio.file.Path;

@ExtendWith(MockitoExtension.class)
class Challenge15Test {
class Challenge16Test {

@Mock
private ScoreCard scoreCard;

@Test
void solveChallenge15WithoutFile(@TempDir Path dir) {
var challenge = new Challenge15(scoreCard, dir.toString());
var challenge = new Challenge16(scoreCard, dir.toString());

Assertions.assertThat(challenge.answerCorrect("secretvalueWitFile")).isFalse();
Assertions.assertThat(challenge.answerCorrect("if_you_see_this_please_use_docker_instead")).isTrue();
Expand All @@ -34,7 +34,7 @@ void solveChallenge15WithMNTFile(@TempDir Path dir) throws Exception {
var secret = "secretvalueWitFile";
Files.writeString(testFile.toPath(), secret);

var challenge = new Challenge15(scoreCard, dir.toString());
var challenge = new Challenge16(scoreCard, dir.toString());

Assertions.assertThat(challenge.answerCorrect("secretvalueWitFile")).isTrue();
}
Expand All @@ -45,7 +45,7 @@ void spoilShouldReturnCorrectAnswer(@TempDir Path dir) throws IOException {
var secret = "secretvalueWitFile";
Files.writeString(testFile.toPath(), secret);

var challenge = new Challenge15(scoreCard, dir.toString());
var challenge = new Challenge16(scoreCard, dir.toString());

Assertions.assertThat(challenge.spoiler()).isEqualTo(new Spoiler("secretvalueWitFile"));
}
Expand Down

0 comments on commit 1ec4543

Please sign in to comment.