■ ■ ■ ■ ■ ■
src/test/java/org/owasp/wrongsecrets/ChallengesControllerTest.java
| skipped 42 lines |
43 | 43 | | when(challenge.solved(anyString())).thenReturn(false); |
44 | 44 | | |
45 | 45 | | this.mvc.perform(post("/challenge/1") |
46 | | - | .param("solution", "wrong") |
47 | | - | .param("action", "submit")) |
48 | | - | .andExpect(status().isOk()) |
49 | | - | .andExpect(model().attributeDoesNotExist("answerCorrect")) |
50 | | - | .andExpect(model().attributeExists("answerIncorrect")); |
| 46 | + | .param("solution", "wrong") |
| 47 | + | .param("action", "submit")) |
| 48 | + | .andExpect(status().isOk()) |
| 49 | + | .andExpect(model().attributeDoesNotExist("answerCorrect")) |
| 50 | + | .andExpect(model().attributeExists("answerIncorrect")); |
51 | 51 | | this.mvc.perform(get("/challenge/1")); |
52 | 52 | | } |
53 | 53 | | |
| skipped 1 lines |
55 | 55 | | void shouldReturnSpoiler() throws Exception { |
56 | 56 | | when(challenge.spoiler()).thenReturn(new Spoiler("solution")); |
57 | 57 | | this.mvc.perform(get("/spoil-1")) |
58 | | - | .andExpect(status().isOk()) |
59 | | - | .andExpect(model().attribute("spoiler", new Spoiler("solution"))); |
| 58 | + | .andExpect(status().isOk()) |
| 59 | + | .andExpect(model().attribute("spoiler", new Spoiler("solution"))); |
60 | 60 | | } |
61 | 61 | | |
62 | 62 | | @Test |
| skipped 1 lines |
64 | 64 | | when(challenge.solved(anyString())).thenReturn(false); |
65 | 65 | | |
66 | 66 | | this.mvc.perform(post("/challenge/1") |
67 | | - | .param("solution", "wrong") |
68 | | - | .param("action", "submit")) |
69 | | - | .andExpect(status().isOk()) |
70 | | - | .andExpect(model().attributeDoesNotExist("answerCorrect")) |
71 | | - | .andExpect(model().attributeExists("answerIncorrect")); |
| 67 | + | .param("solution", "wrong") |
| 68 | + | .param("action", "submit")) |
| 69 | + | .andExpect(status().isOk()) |
| 70 | + | .andExpect(model().attributeDoesNotExist("answerCorrect")) |
| 71 | + | .andExpect(model().attributeExists("answerIncorrect")); |
72 | 72 | | } |
73 | 73 | | |
74 | 74 | | @Test |
| skipped 1 lines |
76 | 76 | | when(challenge.solved(anyString())).thenReturn(true); |
77 | 77 | | |
78 | 78 | | this.mvc.perform(post("/challenge/1") |
79 | | - | .param("solution", "wrong") |
80 | | - | .param("action", "submit")) |
81 | | - | .andExpect(status().isOk()) |
82 | | - | .andExpect(model().attributeExists("answerCorrect")) |
83 | | - | .andExpect(model().attributeDoesNotExist("answerIncorrect")); |
| 79 | + | .param("solution", "wrong") |
| 80 | + | .param("action", "submit")) |
| 81 | + | .andExpect(status().isOk()) |
| 82 | + | .andExpect(model().attributeExists("answerCorrect")) |
| 83 | + | .andExpect(model().attributeDoesNotExist("answerIncorrect")); |
84 | 84 | | } |
85 | 85 | | |
86 | 86 | | @Test |
87 | | - | void shouldReturnCompleteWhenAllItemsDone() throws Exception{ |
| 87 | + | void shouldReturnCompleteWhenAllItemsDone() throws Exception { |
88 | 88 | | when(challenge.solved(anyString())).thenReturn(true); |
89 | 89 | | this.mvc.perform(post("/challenge/1") |
90 | 90 | | .param("solution", "wrong") |
| skipped 2 lines |
93 | 93 | | .andExpect(model().attributeExists("answerCorrect")) |
94 | 94 | | .andExpect(model().attributeExists("allCompleted")); |
95 | 95 | | } |
| 96 | + | |
96 | 97 | | } |
97 | 98 | | |