@@ -0,0 +1,3060 @@
+package com.telekom.m2m.cot.restsdk.audit;%0A%0Aimport com.google.gson.Gson;%0Aimport com.telekom.m2m.cot.restsdk.CloudOfThingsRestClient;%0Aimport com.telekom.m2m.cot.restsdk.util.Filter;%0Aimport com.telekom.m2m.cot.restsdk.util.GsonUtils;%0Aimport org.mockito.Mockito;%0Aimport org.testng.Assert;%0Aimport org.testng.annotations.Test;%0A%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Matchers.eq;%0A%0A/**%0A * Created by Andreas Dyck on 26.07.17.%0A */%0Apublic class AuditApiTest %7B%0A%0A    private final CloudOfThingsRestClient cotRestClientMock = Mockito.mock(CloudOfThingsRestClient.class);%0A%0A    @Test%0A    public void testAuditApi() %7B%0A        AuditApi auditApi = new AuditApi(cotRestClientMock);%0A%0A        Assert.assertNotNull(auditApi);%0A    %7D%0A%0A    @Test%0A    public void testGetAuditRecord() %7B%0A        final AuditApi auditApi = new AuditApi(cotRestClientMock);%0A%0A        final String auditRecordId = %22234%22;%0A        final String text = %22new audit record created%22;%0A%0A        final AuditRecord testAuditRecord = new AuditRecord();%0A        testAuditRecord.setId(auditRecordId);%0A        testAuditRecord.setText(text);%0A%0A        final Gson gson = GsonUtils.createGson();%0A        final String json = gson.toJson(testAuditRecord);%0A%0A        Mockito.when(cotRestClientMock.getResponse(eq(auditRecordId), any(String.class), any(String.class))).thenReturn(json);%0A%0A        AuditRecord retrievedAuditRecord = auditApi.getAuditRecord(auditRecordId);%0A%0A        Assert.assertNotNull(retrievedAuditRecord);%0A        Assert.assertEquals(retrievedAuditRecord.getId(), auditRecordId);%0A        Assert.assertEquals(retrievedAuditRecord.getText(), text);%0A    %7D%0A%0A    @Test%0A    public void testCreateAuditRecord() %7B%0A        final AuditApi auditApi = new AuditApi(cotRestClientMock);%0A%0A        final String auditRecordId = %22234%22;%0A        final String text = %22new audit record created%22;%0A%0A        final AuditRecord testAuditRecord = new AuditRecord();%0A        testAuditRecord.setText(text);%0A%0A        Mockito.when(cotRestClientMock.doRequestWithIdResponse(any(String.class), any(String.class), any(String.class))).thenReturn(auditRecordId);%0A%0A        AuditRecord createdAuditRecord = auditApi.createAuditRecord(testAuditRecord);%0A%0A        Assert.assertNotNull(createdAuditRecord);%0A        Assert.assertEquals(createdAuditRecord.getId(), auditRecordId);%0A        Assert.assertEquals(createdAuditRecord.getText(), text);%0A    %7D%0A%0A    @Test%0A    public void testGetAuditRecords() %7B%0A        final AuditApi auditApi = new AuditApi(cotRestClientMock);%0A%0A        AuditRecordCollection auditRecordCollection = auditApi.getAuditRecords();%0A%0A        Assert.assertNotNull(auditRecordCollection);%0A    %7D%0A%0A    @Test%0A    public void testGetAuditRecordsWithFilter() %7B%0A        final AuditApi auditApi = new AuditApi(cotRestClientMock);%0A        final String type = %22com_telekom_audit_TestType%22;%0A        Filter.FilterBuilder filterBuilder = Filter.build().byType(type);%0A%0A        AuditRecordCollection auditRecordCollection = auditApi.getAuditRecords(filterBuilder);%0A%0A        Assert.assertNotNull(auditRecordCollection);%0A    %7D%0A%7D%0A

add another audit API unit test