package com.microsoft.rest.v2.http;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

import static org.junit.Assert.*;

public class HttpRequestTests {
    @Test
    public void constructor() {
        final HttpRequest request = new HttpRequest("request caller method", "request http method", "request url");
        assertEquals("request caller method", request.callerMethod());
        assertEquals("request http method", request.httpMethod());
        assertEquals("request url", request.url());
    }

    @Test
    public void testClone() {
        final HttpHeaders headers = new HttpHeaders();
        headers.set("my-header", "my-value");
        headers.set("other-header", "other-value");

        final HttpRequest request = new HttpRequest(
                "request caller method",
                "request http method",
                "request url",
                headers,
                new ByteArrayHttpRequestBody(new byte[0], "application/octet-stream"));

        final HttpRequest clonedRequest = request.clone();

        assertNotEquals(request, clonedRequest);
        assertNotEquals(request.headers(), clonedRequest.headers());

        assertEquals(request.callerMethod(), clonedRequest.callerMethod());
        assertEquals(request.httpMethod(), clonedRequest.httpMethod());
        assertEquals(request.url(), clonedRequest.url());

        assertEquals(request.headers().toMap().size(), clonedRequest.headers().toMap().size());
        for (HttpHeader clonedHeader : clonedRequest.headers()) {
            for (HttpHeader originalHeader : request.headers()) {
                if (clonedHeader == originalHeader) {
                    fail("Failed to clone HttpHeader instance");
                }
            }

            assertEquals(clonedHeader.value(), request.headers().value(clonedHeader.name()));
        }

        assertEquals(request.body(), clonedRequest.body());
    }
}

@@ -1081,81 +1081,20 @@
 tNot
-Equals(request, clonedRequest);%0A        assertNotEquals(request.headers()
+Same(request
 , cl
@@ -1104,26 +1104,16 @@
 dRequest
-.headers()
 );%0A%0A    
@@ -1311,24 +1311,91 @@
 st.url());%0A%0A
+        assertNotSame(request.headers(), clonedRequest.headers());%0A
         asse
@@ -1630,11 +1630,21 @@
     
-if 
+assertNotSame
 (clo
@@ -1656,11 +1656,9 @@
 ader
- ==
+,
  ori
@@ -1673,93 +1673,9 @@
 der)
- %7B%0A                    fail(%22Failed to clone HttpHeader instance%22);%0A                %7D
+;
 %0A   
@@ -1797,38 +1797,36 @@
 %0A%0A        assert
-Equals
+Same
 (request.body(),

Use assertSame/assertNotSame for identity comparison