package com.github.javadev.nazk.client;

import java.util.Map;
import com.github.underscore.lodash.$;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

public class HttpClientTest {
    private static NazkClient client = HttpClient.createDefault();

    @Test
    public void getDeclarations() throws Exception {
        Map<String, Object> declarations = client.getDeclarations("");
        assertEquals("1", $.get(declarations, "page.currentPage").toString());
        assertEquals("400", $.get(declarations, "page.batchSize").toString());
    }

    @Test
    public void getDeclaration() throws Exception {
        Map<String, Object> declarations = client.getDeclarations("");
        String id = (String) $.get(declarations, "items.0.id");
        Map<String, Object> declaration = client.getDeclaration(id);
        assertEquals("1", $.get(declaration, "data.step_0.declarationType").toString());
    }

    @Test
    public void main() {
        HttpClient.main("test");
    }
}

@@ -655,33 +655,32 @@
 ect%3E declaration
-s
  = client.getDec
@@ -691,43 +691,75 @@
 tion
-s
 (%22
-%22);%0A        String id = (String)
+043c6b5d-a470-4fb0-bc3b-3332af7fe10e%22);%0A        assertEquals(%221%22,
  $.g
@@ -776,92 +776,51 @@
 tion
-s
 , %22
-items.0.id%22);%0A        Map%3CString, Object%3E declaration = client.getDeclaration(id
+data.step_0.declarationType%22).toString()
 );%0A 
@@ -832,33 +832,51 @@
   assertEquals(%22
-1
+%D0%9B%D1%8E%D1%81%D1%82%D0%B4%D0%BE%D1%80%D1%84%D1%81%D1%8C%D0%BA%D0%B0 %D0%B4%D0%BE%D1%80%D0%BE%D0%B3%D0%B0
 %22, $.get(declara
@@ -892,33 +892,24 @@
 ta.step_
-0.declarationType
+1.street
 %22).toStr

Improve unit test.