@@ -0,0 +1,2553 @@
+package org.sagebionetworks.web.unitserver;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Matchers.anyString;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport java.util.ArrayList;%0Aimport java.util.List;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.mockito.Mock;%0Aimport org.mockito.MockitoAnnotations;%0Aimport org.sagebionetworks.client.SynapseClient;%0Aimport org.sagebionetworks.client.exceptions.SynapseException;%0Aimport org.sagebionetworks.repo.model.dataaccess.AccessRequirementStatus;%0Aimport org.sagebionetworks.schema.adapter.JSONObjectAdapterException;%0Aimport org.sagebionetworks.web.server.servlet.DataAccessClientImpl;%0Aimport org.sagebionetworks.web.server.servlet.ServiceUrlProvider;%0Aimport org.sagebionetworks.web.server.servlet.SynapseProvider;%0Aimport org.sagebionetworks.web.server.servlet.TokenProvider;%0Aimport org.sagebionetworks.web.shared.exceptions.RestServiceException;%0A%0Apublic class DataAccessClientImplTest %7B%0A%09@Mock%0A%09SynapseProvider mockSynapseProvider;%0A%09@Mock%0A%09TokenProvider mockTokenProvider;%0A%09@Mock%0A%09ServiceUrlProvider mockUrlProvider;%0A%09@Mock%0A%09SynapseClient mockSynapse;%0A%09@Mock%0A%09AccessRequirementStatus mockAccessRequirementStatus;%0A%09DataAccessClientImpl dataAccessClient;%0A%09public static final String AR_ID1 = %228765%22;%0A%09public static final String AR_ID2 = %225678%22;%0A%09public static final boolean IS_APPROVED = false;%0A%09@Before%0A%09public void before() throws SynapseException, JSONObjectAdapterException %7B%0A%09%09MockitoAnnotations.initMocks(this);%0A%09%09dataAccessClient = new DataAccessClientImpl();%0A%09%09dataAccessClient.setSynapseProvider(mockSynapseProvider);%0A%09%09dataAccessClient.setTokenProvider(mockTokenProvider);%0A%09%09dataAccessClient.setServiceUrlProvider(mockUrlProvider);%0A%09%09when(mockSynapseProvider.createNewClient()).thenReturn(mockSynapse);%0A%09%09when(mockSynapse.getAccessRequirementStatus(anyString())).thenReturn(mockAccessRequirementStatus);%0A%09%09when(mockAccessRequirementStatus.getIsApproved()).thenReturn(IS_APPROVED);%0A%09%7D%0A%09%0A%09@Test%0A%09public void testGetAccessRequirementStatus() throws RestServiceException, SynapseException %7B%0A%09%09List%3CString%3E accessRequirementIds = new ArrayList%3CString%3E();%0A%09%09accessRequirementIds.add(AR_ID1);%0A%09%09accessRequirementIds.add(AR_ID2);%0A%09%09List%3CBoolean%3E response = dataAccessClient.getAccessRequirementStatus(accessRequirementIds);%0A%09%09verify(mockSynapse).getAccessRequirementStatus(AR_ID1);%0A%09%09verify(mockSynapse).getAccessRequirementStatus(AR_ID1);%0A%09%09for (Boolean isApproved : response) %7B%0A%09%09%09assertEquals(IS_APPROVED, isApproved);%0A%09%09%7D%0A%09%7D%0A%7D%0A

add test for data access client (now that it does more than a thin wrapper for one method)