content: /*
   * This file was automatically generated by UTestGen and EvoSuite
   * Wed Mar 20 11:28:06 GMT 2024
   */
  
  package org.scribe.model;
  
  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.runtime.EvoAssertions.*;
  import java.net.HttpURLConnection;
  import java.util.Map;
  import org.evosuite.runtime.EvoRunner;
  import org.evosuite.runtime.EvoRunnerParameters;
  import org.junit.runner.RunWith;
  import org.scribe.model.Request;
  import org.scribe.model.Verb;
  
  @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) 
  public class Request_ESTest extends Request_ESTest_scaffolding {
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBodyContentsThrowsRuntimeException() throws Throwable  {
        Verb arg0 = Verb.PUT;
        Request request = new Request(arg0, ""); // Create a new HTTP PUT request with an empty body
        request.setCharset("Cannot encode null string"); // Set the character set of the request to 'Cannot encode null string'
        try {
        request.getBodyContents(); // Try to retrieve the body contents of the request
        fail("Expecting exception: RuntimeException"); // Fail if no exception is thrown
        } catch(RuntimeException e) {
        // Verify that the expected exception was thrown
        verifyException("org.scribe.model.Request", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetVerbReturningNonNull() throws Throwable  {
        // Given a request with verb PUT and a message
        Verb arg0 = Verb.PUT;
        Request request = new Request(arg0, "Unsupported Charset: ");
        
        // When the request is created
        Verb verb = request.getVerb();
        
        // Then the verb should be PUT
        assertEquals(Verb.PUT, verb);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetUrlReturningNonEmptyString() throws Throwable  {
        // Given
        Verb arg0 = Verb.GET;
        Request request = new Request(arg0, ";b)o0_hy;!_f");
        
        // When
        String url = request.getUrl();
        
        // Then
        assertEquals(";b)o0_hy;!_f", url);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetUrlReturningEmptyString() throws Throwable  {
        Verb httpMethod = Verb.GET;
        Request request = new Request(httpMethod, "");
        String requestedUrl = request.getUrl();
        assertEquals("", requestedUrl);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSanitizedUrlReturningEmptyString() throws Throwable  {
        // Given a POST request with an empty URL
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "");
        
        // When the sanitized URL is obtained
        String sanitizedUrl = request.getSanitizedUrl();
        
        // Then the sanitized URL should be an empty string
        assertEquals("", sanitizedUrl);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCharsetReturningNonEmptyString() throws Throwable  {
        // Given a Request object with the verb "PUT" and a resource path of "O(EJ'?"
        Verb arg0 = Verb.PUT;
        Request request = new Request(arg0, "O(EJ'?");
        
        // When the getCharset() method is called on the Request object
        String charset = request.getCharset();
        
        // Then the result should be "UTF-8"
        assertEquals("UTF-8", charset);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetVerbReturningNull() throws Throwable  {
        // No Comments were added
        Request request = new Request((Verb) null, "true");
        request.getVerb();
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBodyContentsReturningEmptyString() throws Throwable  {
        // Given: A Request object with a POST method and a body containing "#3(~`&%7+E#QxM^|N$"
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "#3(~`&%7+E#QxM^|N$");
        
        // When: The body contents are retrieved
        String bodyContents = request.getBodyContents();
        
        // Then: The returned body contents is an empty string
        assertEquals("", bodyContents);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddPayload() throws Throwable  {
        // Given a request with a POST verb and a payload
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "payload");
        
        // When the body contents are accessed
        String bodyContents = request.getBodyContents();
        
        // Then the expected payload is returned
        assertEquals("payload", bodyContents);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddQuerystringParameter() throws Throwable  {
        // Given: A Request object with a verb of DELETE and a URL pattern that contains placeholders
        Request request = new Request(Verb.DELETE, "d{4}");
        
        // When: The addQuerystringParameter method is called with the same placeholder as the URL pattern
        request.addQuerystringParameter("d{4}", "d{4}");
        
        // Then: The verb of the request should still be DELETE and the query string parameters should contain the value "d{4}" for the placeholder
        assertEquals(Verb.DELETE, request.getVerb());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetQueryStringParamsThrowsRuntimeException() throws Throwable  {
        // Arrange
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, "AG^I#f");
        
        // Act
        try {
        request.getQueryStringParams();
        } catch (RuntimeException e) {
        // Assert
        verifyException("org.scribe.model.Request", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetSanitizedUrlReturningNonEmptyString() throws Throwable  {
        // Arrange
        Verb deleteVerb = Verb.DELETE;
        Request request = new Request(deleteVerb, "\"P|u@S7O:8~?jBPb");
        
        // Act
        String sanitizedUrl = request.getSanitizedUrl();
        
        // Assert
        assertEquals("\"P|u@S7O:8~", sanitizedUrl);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSendThrowsRuntimeException() throws Throwable  {
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "X?:Oo-)ww&");
        // Undeclared exception!
        try {
        request.send();
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        //
        // Problems while creating connection
        //
        verifyException("org.scribe.model.Request", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testSetConnectionKeepAlive() throws Throwable  {
        // Given a request object with a verb of POST and a URL containing special characters
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "bvc*f)fxH:|#;?v");
        request.setConnectionKeepAlive(true);
        
        // When the request is sent with keep-alive set to true
        try {
        request.send();
        fail("Expecting exception: RuntimeException");
        } catch(RuntimeException e) {
        // Then an exception should be thrown because of problems while creating the connection
        verifyException("org.scribe.model.Request", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddHeader() throws Throwable  {
        // Given: a Request object with an HTTP method of PUT and a resource path of "fQ"
        Verb arg0 = Verb.PUT;
        Request request = new Request(arg0, "fQ");
        
        // When: the header is added to the Request object
        request.addHeader("", "");
        
        // Then: the headers Map is not empty
        Map<String, String> headers = request.getHeaders();
        assertFalse(headers.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testToString() throws Throwable  {
        // Given a Request object with a DELETE verb
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, "");
        
        // When the toString() method is called on the request object
        String string = request.toString();
        
        // Then the resulting string should be "@Request(DELETE )"
        assertEquals("@Request(DELETE )", string);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetCharsetReturningEmptyString() throws Throwable  {
        // Given a Request object with an empty string as the charset
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, "AG^I#f");
        request.setCharset("");
        
        // When the getCharset method is called
        String charset = request.getCharset();
        
        // Then the empty string should be returned
        assertEquals("", charset);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetUrlReturningNull() throws Throwable  {
        // Given
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, null);
        
        // When
        String url = request.getUrl();
        
        // Then
        assertNull(url);
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddBodyParameter() throws Throwable  {
        // No Comments were added
        Verb arg0 = Verb.POST;
        Request request = new Request(arg0, "");
        request.addBodyParameter("FylOzzx>", "M\"[Y");
        Map<String, String> bodyParams = request.getBodyParams();
        assertFalse(bodyParams.isEmpty());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testAddBodyThrowsNullPointerException() throws Throwable  {
        // Given a Request object with verb DELETE and no body
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, (String) null);
        
        // When addBody method is called with null connection
        try {
        request.addBody((HttpURLConnection) null, (byte[]) null);
        
        // Then an exception should be thrown with message "NullPointerException"
        fail("Expecting exception: NullPointerException");
        
        } catch(NullPointerException e) {
        // Verify that the expected exception is thrown
        verifyException("org.scribe.model.Request", e);}
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetHeadersReturningMapWhereIsEmptyIsTrueAndMapWhereSizeIsZero() throws Throwable  {
        // Given a Request object with verb PUT and path fQ
        Verb arg0 = Verb.PUT;
        Request request = new Request(arg0, "fQ");
        
        // When we get the headers from the Request object
        Map<String, String> headers = request.getHeaders();
        
        // Then we expect there to be no headers in the map
        assertEquals(0, headers.size());
    }
  
    @Test
    @Timeout(value = 4000 , unit = TimeUnit.MILLISECONDS)
    public void testGetBodyParamsReturningMapWhereIsEmptyIsTrueAndMapWhereSizeIsZero() throws Throwable  {
        // Arrange
        Verb arg0 = Verb.DELETE;
        Request request = new Request(arg0, null);
        
        // Act
        Map<String, String> bodyParams = request.getBodyParams();
        
        // Assert
        assertEquals(0, bodyParams.size());
    }
  }
  