Run unit tests again for all lessons and rewrite all to JUnit 5

Due to the migration to Spring Boot 2.4 the Vintage dependency was no longer included by default, resulting in skipping all unit tests.
This commit is contained in:
Nanne Baars
2021-03-30 17:50:55 +02:00
committed by Nanne Baars
parent 1d6a5ca01b
commit cda852f4e8
122 changed files with 613 additions and 508 deletions

View File

@ -29,7 +29,13 @@ import org.owasp.webgoat.assignments.AttackResult;
import org.owasp.webgoat.password_reset.resetlink.PasswordChangeForm;
import org.springframework.ui.Model;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
import java.util.ArrayList;

View File

@ -28,13 +28,16 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import java.util.UUID;
import static org.springframework.util.StringUtils.*;
import static org.springframework.util.StringUtils.hasText;
/**
* Part of the password reset assignment. Used to send the e-mail.

View File

@ -25,7 +25,10 @@ package org.owasp.webgoat.password_reset;
import org.owasp.webgoat.assignments.AssignmentEndpoint;
import org.owasp.webgoat.assignments.AttackResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.Map;

View File

@ -2,7 +2,7 @@ package org.owasp.webgoat.password_reset;
import org.hamcrest.CoreMatchers;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.owasp.webgoat.plugins.LessonTest;
@ -15,13 +15,13 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@RunWith(SpringJUnit4ClassRunner.class)
@ExtendWith(SpringExtension.class)
public class SecurityQuestionAssignmentTest extends LessonTest {
@Autowired
private PasswordReset passwordReset;
@Before
@BeforeEach
public void setup() {
Mockito.when(webSession.getCurrentLesson()).thenReturn(passwordReset);
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build();