Below is my test class. The hello-world endpoint simply returns an HTML page containing text i.e. Hello Stranger!

```
@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class HelloWorldTest {

    @Autowired
    private HelloWorldController controller;

    @Autowired
    private TestRestTemplate restTemplate;

    @LocalServerPort
    private int port;

    @Test
    public void contextLoads() throws Exception {
        assertThat(controller).isNotNull();
    }

    @Test
    public void greetingShouldReturnDefaultMessage() throws Exception {

        String baseUrl = "http://localhost:" + port;

        assertThat(this.restTemplate.getForObject(baseUrl+"/hello-world", String.class))
                .contains("Hello Stranger!");
    }
}

```

This is my Security Config:

```
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
            .antMatchers("/", "/home").permitAll()
            .anyRequest().authenticated()
            .and()
            .formLogin()
            .loginPage("/login")
            .permitAll()
            .and()
            .logout()
            .permitAll();
    }
}

```

It simply redirects all authenticated users to the login page

I have tried adding @WithMockUser annotation or adding another security config class in my test directory to override the default config. But so far nothing has seemed to work.

Any help or suggestions on documentation to read is appreciated!