package kz.arta.synergy.workflow.mobile.android.offline;

import android.test.suitebuilder.annotation.SmallTest;

import org.junit.Assert;
import org.junit.Test;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;

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

import kz.arta.synergy.workflow.mobile.android.comments.models.CommentItem;
import kz.arta.synergy.workflow.mobile.android.common.models.offline.OfflineAttachment;
import kz.arta.synergy.workflow.mobile.android.common.models.offline.OfflineComment;
import kz.arta.synergy.workflow.mobile.android.common.models.offline.OfflineEditComment;
import kz.arta.synergy.workflow.mobile.android.common.models.offline.OfflineRemoveAttachment;
import kz.arta.synergy.workflow.mobile.android.common.models.offline.OfflineRemoveComment;
import kz.arta.synergy.workflow.mobile.android.common.requests.SendGetRequest;
import kz.arta.synergy.workflow.mobile.android.documents.offline.DocumentAttachmentsTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.DocumentCommentsTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.DocumentFiltersTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.DocumentSync;
import kz.arta.synergy.workflow.mobile.android.documents.offline.DocumentTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.actions.DocumentAddAttachmentTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.actions.DocumentAddCommentTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.actions.DocumentEditCommentTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.actions.DocumentRemoveAttachmentTable;
import kz.arta.synergy.workflow.mobile.android.documents.offline.actions.DocumentRemoveCommentTable;

/**
 * Created by neox on 04.10.16.
 * Тесты для оффлайн режима (документы)
 */
@SmallTest
public class DocumentsOfflineUnitTest {

    @Test
    public void getNewAttachmentsByDocumentID() {
        OfflineAttachment offlineAttachment = new OfflineAttachment();
        offlineAttachment.setActionID("actionID");
        offlineAttachment.setName("name");
        offlineAttachment.setFilepath("filePath");
        offlineAttachment.setFilename("fileName");
        offlineAttachment.setDate("date");
        List<OfflineAttachment> result = new ArrayList<>();
        result.add(offlineAttachment);
        DocumentAddAttachmentTable db = Mockito.mock(DocumentAddAttachmentTable.class);
        Mockito.when(db.getByDocumentID("documentID")).thenReturn(result);
        Assert.assertEquals(db.getByDocumentID("documentID"), result);
    }

    @Test
    public void getAllNewAttachments() {
        OfflineAttachment offlineAttachment = new OfflineAttachment();
        offlineAttachment.setActionID("actionID");
        offlineAttachment.setName("name");
        offlineAttachment.setFilepath("filePath");
        offlineAttachment.setFilename("fileName");
        offlineAttachment.setDate("date");
        List<OfflineAttachment> result = new ArrayList<>();
        result.add(offlineAttachment);
        DocumentAddAttachmentTable db = Mockito.mock(DocumentAddAttachmentTable.class);
        Mockito.when(db.get()).thenReturn(result);
        Assert.assertEquals(db.get(), result);
    }

    @Test
    public void getCommentsByDocumentID() {
        OfflineComment offlineComment = new OfflineComment();
        offlineComment.setActionID("actionID");
        offlineComment.setName("name");
        offlineComment.setAuthor("authorID");
        offlineComment.setComment("comment");
        offlineComment.setTime("time");
        offlineComment.setType("type");
        List<OfflineComment> result = new ArrayList<>();
        result.add(offlineComment);
        DocumentAddCommentTable db = Mockito.mock(DocumentAddCommentTable.class);
        Mockito.when(db.getByDocumentID("documentID")).thenReturn(result);
        Assert.assertEquals(db.getByDocumentID("documentID"), result);
    }

    @Test
    public void getAllComments() {
        OfflineComment offlineComment = new OfflineComment();
        offlineComment.setActionID("actionID");
        offlineComment.setName("name");
        offlineComment.setAuthor("authorID");
        offlineComment.setComment("comment");
        offlineComment.setTime("time");
        offlineComment.setType("type");
        List<OfflineComment> result = new ArrayList<>();
        result.add(offlineComment);
        DocumentAddCommentTable db = Mockito.mock(DocumentAddCommentTable.class);
        Mockito.when(db.get()).thenReturn(result);
        Assert.assertEquals(db.get(), result);
    }

    @Test
    public void getEditComments() {
        OfflineEditComment offlineEditComment = new OfflineEditComment();
        offlineEditComment.setActionID("actionID");
        offlineEditComment.setComment("comment");
        offlineEditComment.setName("name");
        offlineEditComment.setCommentID("commentID");
        List<OfflineEditComment> result = new ArrayList<>();
        result.add(offlineEditComment);
        DocumentEditCommentTable db = Mockito.mock(DocumentEditCommentTable.class);
        Mockito.when(db.get()).thenReturn(result);
        Assert.assertEquals(db.get(), result);
    }

    @Test
    public void getRemoveAttachments() {
        OfflineRemoveAttachment offlineRemoveAttachment = new OfflineRemoveAttachment();
        offlineRemoveAttachment.setActionID("actionID");
        offlineRemoveAttachment.setName("name");
        offlineRemoveAttachment.setNodeUUID("nodeUUID");
        offlineRemoveAttachment.setFileName("fileName");
        List<OfflineRemoveAttachment> result = new ArrayList<>();
        result.add(offlineRemoveAttachment);
        DocumentRemoveAttachmentTable db = Mockito.mock(DocumentRemoveAttachmentTable.class);
        Mockito.when(db.get()).thenReturn(result);
        Assert.assertEquals(db.get(), result);
    }

    @Test
    public void getRemoveComments() {
        OfflineRemoveComment offlineRemoveComment = new OfflineRemoveComment();
        offlineRemoveComment.setActionID("actionID");
        offlineRemoveComment.setName("name");
        offlineRemoveComment.setCommentID("commentID");
        offlineRemoveComment.setCommentName("commentName");
        List<OfflineRemoveComment> result = new ArrayList<>();
        result.add(new OfflineRemoveComment());
        DocumentRemoveCommentTable db = Mockito.mock(DocumentRemoveCommentTable.class);
        Mockito.when(db.get()).thenReturn(result);
        Assert.assertEquals(db.get(), result);
    }

    @Test
    public void getDocumentAttachments() {
        String result = "[]";
        DocumentAttachmentsTable db = Mockito.mock(DocumentAttachmentsTable.class);
        Mockito.when(db.get("documentID")).thenReturn(result);
        Assert.assertEquals(db.get("documentID"), result);
    }

    @Test
    public void getDocumentComments() {
        CommentItem comment = new CommentItem();
        comment.setComment("comment");
        List<CommentItem> result = new ArrayList<>();
        result.add(comment);
        DocumentCommentsTable db = Mockito.mock(DocumentCommentsTable.class);
        Mockito.when(db.get("documentID")).thenReturn(result);
        Assert.assertEquals(db.get("documentID"), result);
    }

    @Test
    public void getDocumentFilters() {
        String result = "[]";
        DocumentFiltersTable db = Mockito.mock(DocumentFiltersTable.class);
        Mockito.when(db.get("documentID")).thenReturn(result);
        Assert.assertEquals(db.get("documentID"), result);
    }

    @Test
    public void getDocumentList() {
        String result = "[]";
        DocumentTable db = Mockito.mock(DocumentTable.class);
        Mockito.when(db.get("documentID")).thenReturn(result);
        Assert.assertEquals(db.get("documentID"), result);
    }

    @Test
    public void getAllDocumentList() {
        List<String> result = new ArrayList<>();
        result.add("1");
        result.add("2");
        result.add("3");
        DocumentTable db = Mockito.mock(DocumentTable.class);
        Mockito.when(db.getAll()).thenReturn(result);
        Assert.assertEquals(db.getAll(), result);
        Assert.assertEquals(db.getAll().size(), 3);
    }

    @Test
    public void getDocument() {
        String result = "document info";
        DocumentTable db = Mockito.mock(DocumentTable.class);
        Mockito.when(db.getDocument("documentID")).thenReturn(result);
        Assert.assertEquals(db.getDocument("documentID"), result);
    }

    @Test
    public void testListSync() throws Exception {

        String oldDocuments = "[{\"name\":\"проверка 1\",\"content\":\"\",\"documentID\":\"01d8c580-6f4c-11e6-87ba-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"Человек\",\"correspondentOrg\":\"организация 1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-31 13:24:00\",\"regDate\":\"2016-08-31 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка\",\"content\":\"\",\"documentID\":\"dba8c540-6f4b-11e6-87ba-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"Человек\",\"correspondentOrg\":\"организация\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-31 13:23:00\",\"regDate\":\"2016-08-31 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"e4d5b8c0-2636-11e6-9ebe-3085a93a6496\",\"number\":\"\",\"author\":\"\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"организация 1\",\"type\":\"DOCUMENT\",\"createDate\":\"\",\"regDate\":\"\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"3ef59470-2636-11e6-9ebe-3085a93a6496\",\"number\":\"\",\"author\":\"\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"dtint-1\",\"type\":\"DOCUMENT\",\"createDate\":\"\",\"regDate\":\"\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"forms62 1\",\"content\":\"\",\"documentID\":\"48b6ec80-fbdd-11e5-ab66-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-04-06 15:52:00\",\"regDate\":\"2016-04-06 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"22222\",\"content\":\"\",\"documentID\":\"14d06280-d6d4-11e5-b906-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-02-19 12:43:00\",\"regDate\":\"2016-02-19 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"жалобы 2\",\"content\":\"\",\"documentID\":\"b153da40-adfa-11e5-9ca2-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2015-12-29 13:06:00\",\"regDate\":\"2015-12-29 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка отправки на регистрацию\",\"content\":\"\",\"documentID\":\"6c1a2b90-856e-11e6-b821-3085a93a6496\",\"number\":\"574\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:26:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"тест резолюции\",\"content\":\"\",\"documentID\":\"2b3dd510-8571-11e6-b821-3085a93a6496\",\"number\":\"000001\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:46:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"true\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"тест регистрации\",\"content\":\"\",\"documentID\":\"4b60ca30-856e-11e6-b821-3085a93a6496\",\"number\":\"0030BBB\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:25:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"123\",\"content\":\"\",\"documentID\":\"a4b3c130-735f-11e6-8e7e-3085a93a6496\",\"number\":\"123\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-05 17:55:00\",\"regDate\":\"2016-09-10 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"111111\",\"content\":\"\",\"documentID\":\"a5253c30-5a3b-11e6-a4da-3085a93a6496\",\"number\":\"572\",\"author\":\"Борщев А.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"12345678 1.2., БейсембаевБейсембаевБейсембаевБейсембаевБейсембаев М.О.\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-04 18:04:00\",\"regDate\":\"2016-08-26 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"ываываываываываыва\",\"content\":\"\",\"documentID\":\"79137c90-4e71-11e6-8e53-3085a93a6496\",\"number\":\"532\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-07-20 17:59:00\",\"regDate\":\"2016-07-20 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"sdfsdfsdf\",\"content\":\"\",\"documentID\":\"73a490b0-393a-11e6-8976-3085a93a6496\",\"number\":\"531\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-23 18:03:00\",\"regDate\":\"2016-06-23 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"68220770-2d6b-11e6-90f0-3085a93a6496\",\"number\":\"432\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:23:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"4af98a70-2d6a-11e6-90f0-3085a93a6496\",\"number\":\"431\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:15:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"2222\",\"content\":\"\",\"documentID\":\"3701f530-2d69-11e6-90f0-3085a93a6496\",\"number\":\"430\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:07:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test\",\"content\":\"\",\"documentID\":\"011ccee0-2d69-11e6-90f0-3085a93a6496\",\"number\":\"429\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:06:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"2\",\"content\":\"\",\"documentID\":\"4d954b60-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"2\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:30:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"1\",\"content\":\"\",\"documentID\":\"372e6e60-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"1\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:30:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"1\",\"content\":\"\",\"documentID\":\"c6f1b700-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"428\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:34:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"cefceaf0-2636-11e6-9ebe-3085a93a6496\",\"number\":\"424\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 13:19:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"47d7e0a0-262e-11e6-88d7-3085a93a6496\",\"number\":\"423\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 12:18:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test2\",\"content\":\"\",\"documentID\":\"3fb84930-262b-11e6-88d7-3085a93a6496\",\"number\":\"422\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 11:56:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test1\",\"content\":\"\",\"documentID\":\"c70786e0-262a-11e6-88d7-3085a93a6496\",\"number\":\"421\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 11:53:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"0030A\",\"content\":\"\",\"documentID\":\"abefe880-f7c6-11e5-9257-3085a93a6496\",\"number\":\"0030A\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-04-01 11:00:00\",\"regDate\":\"2016-04-01 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"ываыва\",\"content\":\"\",\"documentID\":\"95b96fd0-f651-11e5-ba3b-3085a93a6496\",\"number\":\"413\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"Абрамов Е.Г.\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"ыва\",\"correspondentOrg\":\"ыва\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-30 14:29:00\",\"regDate\":\"2016-03-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"true\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"asdasdsd\",\"content\":\"\",\"documentID\":\"8ad29020-f650-11e5-ba3b-3085a93a6496\",\"number\":\"412\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-30 14:22:00\",\"regDate\":\"2016-03-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка бага 9698\",\"content\":\"\",\"documentID\":\"468a5670-dc4a-11e5-80fd-3085a93a6496\",\"number\":\"411\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-02-26 11:32:00\",\"regDate\":\"2016-03-29 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"создаем документ\",\"content\":\"\",\"documentID\":\"46bfa9d0-ea99-11e5-b516-3085a93a6496\",\"number\":\"410\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"вапвапвапвап\",\"correspondentOrg\":\"вапвап\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-15 16:32:00\",\"regDate\":\"2016-03-15 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]}]";
        String newDocuments = "[{\"name\":\"проверка 1\",\"content\":\"\",\"documentID\":\"01d8c580-6f4c-11e6-87ba-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"Человек\",\"correspondentOrg\":\"организация 1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-31 13:24:00\",\"regDate\":\"2016-08-31 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка\",\"content\":\"\",\"documentID\":\"dba8c540-6f4b-11e6-87ba-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"Человек\",\"correspondentOrg\":\"организация\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-31 13:23:00\",\"regDate\":\"2016-08-31 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"e4d5b8c0-2636-11e6-9ebe-3085a93a6496\",\"number\":\"\",\"author\":\"\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"организация 1\",\"type\":\"DOCUMENT\",\"createDate\":\"\",\"regDate\":\"\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"3ef59470-2636-11e6-9ebe-3085a93a6496\",\"number\":\"\",\"author\":\"\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"dtint-1\",\"type\":\"DOCUMENT\",\"createDate\":\"\",\"regDate\":\"\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"forms62 1\",\"content\":\"\",\"documentID\":\"48b6ec80-fbdd-11e5-ab66-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-04-06 15:52:00\",\"regDate\":\"2016-04-06 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"22222\",\"content\":\"\",\"documentID\":\"14d06280-d6d4-11e5-b906-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-02-19 12:43:00\",\"regDate\":\"2016-02-19 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"жалобы 2\",\"content\":\"\",\"documentID\":\"b153da40-adfa-11e5-9ca2-3085a93a6496\",\"number\":\"\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2015-12-29 13:06:00\",\"regDate\":\"2015-12-29 00:00:00\",\"statusID\":\"NOT_STARTED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"false\",\"finished\":\"false\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка отправки на регистрацию\",\"content\":\"\",\"documentID\":\"6c1a2b90-856e-11e6-b821-3085a93a6496\",\"number\":\"574\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:26:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"тест резолюции\",\"content\":\"\",\"documentID\":\"2b3dd510-8571-11e6-b821-3085a93a6496\",\"number\":\"000001\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:46:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"true\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"тест регистрации\",\"content\":\"\",\"documentID\":\"4b60ca30-856e-11e6-b821-3085a93a6496\",\"number\":\"0030BBB\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-28 17:25:00\",\"regDate\":\"2016-09-28 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"123\",\"content\":\"\",\"documentID\":\"a4b3c130-735f-11e6-8e7e-3085a93a6496\",\"number\":\"123\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"Admin A.A.\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-09-05 17:55:00\",\"regDate\":\"2016-09-10 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"111111\",\"content\":\"\",\"documentID\":\"a5253c30-5a3b-11e6-a4da-3085a93a6496\",\"number\":\"572\",\"author\":\"Борщев А.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"12345678 1.2., БейсембаевБейсембаевБейсембаевБейсембаевБейсембаев М.О.\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-08-04 18:04:00\",\"regDate\":\"2016-08-26 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"ываываываываываыва\",\"content\":\"\",\"documentID\":\"79137c90-4e71-11e6-8e53-3085a93a6496\",\"number\":\"532\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-07-20 17:59:00\",\"regDate\":\"2016-07-20 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"sdfsdfsdf\",\"content\":\"\",\"documentID\":\"73a490b0-393a-11e6-8976-3085a93a6496\",\"number\":\"531\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-23 18:03:00\",\"regDate\":\"2016-06-23 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"68220770-2d6b-11e6-90f0-3085a93a6496\",\"number\":\"432\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:23:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"4af98a70-2d6a-11e6-90f0-3085a93a6496\",\"number\":\"431\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:15:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"2222\",\"content\":\"\",\"documentID\":\"3701f530-2d69-11e6-90f0-3085a93a6496\",\"number\":\"430\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:07:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test\",\"content\":\"\",\"documentID\":\"011ccee0-2d69-11e6-90f0-3085a93a6496\",\"number\":\"429\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-08 17:06:00\",\"regDate\":\"2016-06-08 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"2\",\"content\":\"\",\"documentID\":\"4d954b60-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"2\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:30:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"1\",\"content\":\"\",\"documentID\":\"372e6e60-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"1\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:30:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"1\",\"content\":\"\",\"documentID\":\"c6f1b700-2ca3-11e6-8b57-3085a93a6496\",\"number\":\"428\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"1\",\"correspondentOrg\":\"1\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-06-07 17:34:00\",\"regDate\":\"2016-06-07 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"true\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"4\",\"content\":\"\",\"documentID\":\"cefceaf0-2636-11e6-9ebe-3085a93a6496\",\"number\":\"424\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 13:19:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"3\",\"content\":\"\",\"documentID\":\"47d7e0a0-262e-11e6-88d7-3085a93a6496\",\"number\":\"423\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 12:18:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test2\",\"content\":\"\",\"documentID\":\"3fb84930-262b-11e6-88d7-3085a93a6496\",\"number\":\"422\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 11:56:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"test1\",\"content\":\"\",\"documentID\":\"c70786e0-262a-11e6-88d7-3085a93a6496\",\"number\":\"421\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-05-30 11:53:00\",\"regDate\":\"2016-05-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"true\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"0030A\",\"content\":\"\",\"documentID\":\"abefe880-f7c6-11e5-9257-3085a93a6496\",\"number\":\"0030A\",\"author\":\"Admin A.A.\",\"docTypeID\":\"in_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-04-01 11:00:00\",\"regDate\":\"2016-04-01 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"ываыва\",\"content\":\"\",\"documentID\":\"95b96fd0-f651-11e5-ba3b-3085a93a6496\",\"number\":\"413\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"Абрамов Е.Г.\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"ыва\",\"correspondentOrg\":\"ыва\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-30 14:29:00\",\"regDate\":\"2016-03-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"true\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"asdasdsd\",\"content\":\"\",\"documentID\":\"8ad29020-f650-11e5-ba3b-3085a93a6496\",\"number\":\"412\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-30 14:22:00\",\"regDate\":\"2016-03-30 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"проверка бага 9698\",\"content\":\"\",\"documentID\":\"468a5670-dc4a-11e5-80fd-3085a93a6496\",\"number\":\"411\",\"author\":\"Admin A.A.\",\"docTypeID\":\"internal_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"\",\"correspondentOrg\":\"\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-02-26 11:32:00\",\"regDate\":\"2016-03-29 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]},{\"name\":\"создаем документ\",\"content\":\"\",\"documentID\":\"46bfa9d0-ea99-11e5-b516-3085a93a6496\",\"number\":\"410\",\"author\":\"Admin A.A.\",\"docTypeID\":\"out_docs\",\"user\":\"\",\"regUser\":\"Admin A.A.\",\"resUsers\":\"\",\"to\":\"\",\"from\":\"\",\"correspondent\":\"вапвапвапвап\",\"correspondentOrg\":\"вапвап\",\"type\":\"DOCUMENT\",\"createDate\":\"2016-03-15 16:32:00\",\"regDate\":\"2016-03-15 00:00:00\",\"statusID\":\"FINISHED\",\"isExpired\":\"true\",\"isSoonExpired\":\"true\",\"hasChildren\":\"false\",\"hasResolution\":\"false\",\"isNew\":\"false\",\"hidden\":\"false\",\"registered\":\"true\",\"finished\":\"true\",\"inProgress\":\"false\",\"controlled\":\"false\",\"hasAttachments\":\"false\",\"defective\":\"false\",\"actions\":[]}]";

        DocumentTable documentTable = Mockito.mock(DocumentTable.class);
        PowerMockito.when(documentTable.get("key")).thenReturn(oldDocuments);
        PowerMockito.whenNew(DocumentTable.class).withArguments(Mockito.anyObject()).thenReturn(documentTable);

        SendGetRequest sendGetRequest = Mockito.mock(SendGetRequest.class);
        PowerMockito.when(sendGetRequest.requestGET("key")).thenReturn(newDocuments);
        PowerMockito.whenNew(SendGetRequest.class).withArguments(Mockito.anyString(), Mockito.anyObject()).thenReturn(sendGetRequest);

        DocumentSync documentSync = Mockito.mock(DocumentSync.class);
        documentSync.setDocumentsTable(documentTable);
        documentSync.setSendGetRequest(sendGetRequest);
        documentSync.listSync("key");

    }

}
