package fabricator.j.tests;

import org.testng.annotations.Test;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;

public class JavaInternetTestSuite extends JavaBaseTest {

    @Test
    public void testUrl() {
        final HashMap<String, Object> stringStringHashMap = new HashMap<>();
        stringStringHashMap.put("hello", "test");
        stringStringHashMap.put("hello2", "test2");
        stringStringHashMap.put("hello3", "test 3");
        final String url = internet.urlBuilder().host("test.ru").paramsinJava(stringStringHashMap).toString();
        assertTrue(url.matches("^(.*:)//([A-Za-z0-9\\-\\.]+)(:[0-9]+)?(.*)$"));
        String params = url.split("/")[3];
        List<String> stringList = Arrays.asList(params.split("&"));
        assertTrue(stringList.contains("getEntity?hello=test"));
        assertTrue(stringList.contains("hello2=test2"));
        assertTrue(stringList.contains("hello3=test+3"));
    }
}

@@ -809,22 +809,22 @@
 String%3E 
-string
+params
 List = A
@@ -843,16 +843,46 @@
 (params.
+replaceAll(%22getEntity%5C%5C?%22,%22%22).
 split(%22&
@@ -897,38 +897,38 @@
      assertTrue(
-string
+params
 List.contains(%22g
@@ -930,18 +930,8 @@
 ns(%22
-getEntity?
 hell
@@ -952,38 +952,38 @@
      assertTrue(
-string
+params
 List.contains(%22h
@@ -1017,22 +1017,22 @@
 ertTrue(
-string
+params
 List.con

make JavaInternetTestSuite work with Java8