@@ -0,0 +1,2810 @@
+package io.castle.client;%0A%0Aimport io.castle.client.model.*;%0Aimport okhttp3.mockwebserver.MockResponse;%0Aimport okhttp3.mockwebserver.RecordedRequest;%0Aimport org.assertj.core.api.Assertions;%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0Aimport org.springframework.mock.web.MockHttpServletRequest;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport static okhttp3.mockwebserver.SocketPolicy.NO_RESPONSE;%0A%0Apublic class CastleArchiveDevicesHttpTest extends AbstractCastleHttpLayerTest %7B%0A%0A    public CastleArchiveDevicesHttpTest() %7B%0A        super(new AuthenticateFailoverStrategy(AuthenticateAction.CHALLENGE));%0A    %7D%0A%0A    @Test public void archiveDevices() throws Exception %7B%0A        MockResponse mockResponse = new MockResponse();%0A        mockResponse.setBody(%22%7B%5C%22id%5C%22:%5C%22userId%5C%22,%5C%22created_at%5C%22:null,%5C%22updated_at%5C%22:%5C%222019-03-26T11:31:19.968Z%5C%22,%5C%22last_seen_at%5C%22:%5C%222019-03-26T09:38:43.339Z%5C%22,%5C%22flagged_at%5C%22:null,%5C%22risk%5C%22:0.0,%5C%22leaks_count%5C%22:3,%5C%22devices_count%5C%22:2,%5C%22email%5C%22:%5C%22admin@example.com%5C%22,%5C%22name%5C%22:%5C%22Doe%5C%22,%5C%22username%5C%22:null,%5C%22phone%5C%22:null,%5C%22address%5C%22:%7B%5C%22street%5C%22:null,%5C%22city%5C%22:null,%5C%22postal_code%5C%22:null,%5C%22region%5C%22:null,%5C%22country%5C%22:null%7D,%5C%22custom_attributes%5C%22:%7B%7D%7D%22);%0A        server.enqueue(mockResponse);%0A%0A        // And a mock Request%0A        HttpServletRequest request = new MockHttpServletRequest();%0A%0A        // And an devices request is made%0A        CastleUser result = sdk.onRequest(request).archiveUserDevices(%22userId%22);%0A%0A        // Then%0A        RecordedRequest recordedRequest = server.takeRequest();%0A        Assert.assertEquals(testServerBaseUrl.resolve(%22v1/users/userId/archive_devices%22), recordedRequest.getRequestUrl());%0A        Assert.assertEquals(%22PUT%22, recordedRequest.getMethod());%0A%0A        // and the correct Success model object is extracted%0A        CastleUser expected = new CastleUser();%0A        expected.setId(%22userId%22);%0A        expected.setUpdatedAt(%222019-03-26T11:31:19.968Z%22);%0A        expected.setLastSeenAt(%222019-03-26T09:38:43.339Z%22);%0A        expected.setLeaksCount(3);%0A        expected.setDevicesCount(2);%0A        expected.setEmail(%22admin@example.com%22);%0A        expected.setName(%22Doe%22);%0A        expected.setAddress(new CastleUserAddress());%0A        expected.setCustomAttributes(new HashMap%3CString, String%3E());%0A%0A        Assertions.assertThat(result).isEqualToComparingFieldByFieldRecursively(expected);%0A    %7D%0A%0A    @Test(expected = CastleRuntimeException.class)%0A    public void archiveDevicesTimeoutTest() %7B%0A%0A        // given backend request timeouts%0A        server.enqueue(new MockResponse().setSocketPolicy(NO_RESPONSE));%0A        HttpServletRequest request = new MockHttpServletRequest();%0A        String userId = %22userId%22;%0A%0A        //when a review request is made%0A        sdk.onRequest(request).archiveUserDevices(userId);%0A    %7D%0A%7D

Add tests for archive devices api