Example usage for org.springframework.security.test.context TestSecurityContextHolder clearContext

List of usage examples for org.springframework.security.test.context TestSecurityContextHolder clearContext

Introduction

In this page you can find the example usage for org.springframework.security.test.context TestSecurityContextHolder clearContext.

Prototype

public static void clearContext() 

Source Link

Document

Clears the SecurityContext from TestSecurityContextHolder and SecurityContextHolder .

Usage

From source file:io.pivotal.cla.webdriver.AuthenticationTests.java

@Test
@WithSigningUser/*from   ww w  .j  a va  2s  .  c o m*/
@SuppressWarnings("unchecked")
public void signOut() throws Exception {
    when(mockClaRepository.findByNameAndPrimaryTrue(cla.getName())).thenReturn(cla);
    when(mockIndividualSignatureRepository.findByEmailIn(anySet()))
            .thenReturn(Arrays.asList(individualSignature));

    SignClaPage signClaPage = SignClaPage.go(driver, cla.getName());
    signClaPage.assertAt();

    TestSecurityContextHolder.clearContext();

    SignClaPage signOut = signClaPage.signOut();
    signOut.assertAt();

    signOut.assertLogoutSuccess();
}