content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Mon Mar 18 01:22:08 GMT 2024
   */
  
  package org.jsecurity.web.filter.authc;
  
  import org.junit.jupiter.api.Test;
  import static org.junit.jupiter.api.Assertions.*;
  import org.junit.jupiter.api.Timeout;
  import java.util.concurrent.TimeUnit;
  import static org.evosuite.shaded.org.mockito.Mockito.*;
  import static org.evosuite.runtime.EvoAssertions.*;
  import javax.servlet.ServletRequest;
  import javax.servlet.ServletRequestWrapper;
  import javax.servlet.ServletResponse;
  import javax.servlet.ServletResponseWrapper;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.evosuite.runtime.ViolatedAssumptionAnswer;
  import org.jsecurity.web.filter.authc.BasicHttpAuthenticationFilter;
  import org.junit.runner.RunWith;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class BasicHttpAuthenticationFilter_Original_ESTest extends BasicHttpAuthenticationFilter_Original_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testCreateTokenThrowsNullPointerException() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        ServletResponse arg0 = mock(ServletResponse.class, new ViolatedAssumptionAnswer());
        ServletResponseWrapper arg1 = new ServletResponseWrapper(arg0);
        // Undeclared exception!
        try { 
          basicHttpAuthenticationFilter.createToken((ServletRequest) null, arg1);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("org.jsecurity.web.filter.authc.BasicHttpAuthenticationFilter", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsLoginAttemptReturningTrue() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        
        basicHttpAuthenticationFilter.setAuthzScheme("");
        boolean loginAttempt = basicHttpAuthenticationFilter.isLoginAttempt("k");
        assertTrue(loginAttempt);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPrincipalsAndCredentialsTaking2Strings() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        String[] principalsAndCredentials = basicHttpAuthenticationFilter.getPrincipalsAndCredentials("WWW-Authenticate", "2tR}S{=Xl");
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertEquals(1, principalsAndCredentials.length);
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAuthzSchemeReturningNonEmptyString() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        String authzScheme = basicHttpAuthenticationFilter.getAuthzScheme();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        assertEquals("BASIC", authzScheme);
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPrincipalsAndCredentialsTaking1And1WithNonNull() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        ServletRequest arg0 = mock(ServletRequest.class, new ViolatedAssumptionAnswer());
        ServletRequestWrapper arg1 = new ServletRequestWrapper(arg0);
        String[] principalsAndCredentials = basicHttpAuthenticationFilter.getPrincipalsAndCredentials("#gQ_bfcX#YG7oZ&wQy+", arg1);
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        assertNull(principalsAndCredentials);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPrincipalsAndCredentialsTaking1And1WithNull() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        basicHttpAuthenticationFilter.getPrincipalsAndCredentials((String) null, (ServletRequest) null);
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSendChallengeThrowsNullPointerException() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        // Undeclared exception!
        try { 
          basicHttpAuthenticationFilter.sendChallenge((ServletRequest) null, (ServletResponse) null);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("org.jsecurity.web.filter.authc.BasicHttpAuthenticationFilter", e);
        }
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetApplicationNameReturningNonEmptyString() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        String applicationName = basicHttpAuthenticationFilter.getApplicationName();
        assertEquals("application", applicationName);
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetAuthcScheme() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        
        basicHttpAuthenticationFilter.setAuthcScheme((String) null);
        basicHttpAuthenticationFilter.getAuthcScheme();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAuthcSchemeReturningNonEmptyString() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        String authcScheme = basicHttpAuthenticationFilter.getAuthcScheme();
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertEquals("BASIC", authcScheme);
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAuthzSchemeReturningEmptyString() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        
        basicHttpAuthenticationFilter.setAuthzScheme("");
        String authzScheme = basicHttpAuthenticationFilter.getAuthzScheme();
        assertEquals("", authzScheme);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetApplicationName() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        
        basicHttpAuthenticationFilter.setApplicationName((String) null);
        basicHttpAuthenticationFilter.getApplicationName();
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetPrincipalsAndCredentialsTaking1And1ReturningNonEmptyArray() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        String[] principalsAndCredentials = basicHttpAuthenticationFilter.getPrincipalsAndCredentials("Unable to acquire account data from realm [", (ServletRequest) null);
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals(1, principalsAndCredentials.length);
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertNotNull(principalsAndCredentials);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testIsLoginAttemptReturningFalse() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        boolean loginAttempt = basicHttpAuthenticationFilter.isLoginAttempt("P4");
        assertFalse(loginAttempt);
        assertEquals("application", basicHttpAuthenticationFilter.getApplicationName());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthzScheme());
        assertEquals("BASIC", basicHttpAuthenticationFilter.getAuthcScheme());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetAuthzHeaderThrowsNullPointerException() throws Throwable  {
        BasicHttpAuthenticationFilter basicHttpAuthenticationFilter = new BasicHttpAuthenticationFilter();
        // Undeclared exception!
        try { 
          basicHttpAuthenticationFilter.getAuthzHeader((ServletRequest) null);
          fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
           //
           // no message in exception (getMessage() returned null)
           //
           verifyException("org.jsecurity.web.filter.authc.BasicHttpAuthenticationFilter", e);
        }
    }
  }
  