Search in sources :

Example 6 with LocaleManager

use of org.orcid.core.locale.LocaleManager in project ORCID-Source by ORCID.

the class PublicV2ApiServiceDelegatorTest method testSearchByQueryIllegalStart.

@Test(expected = SearchStartParameterLimitExceededException.class)
public void testSearchByQueryIllegalStart() {
    Map<String, List<String>> params = new HashMap<>();
    params.put("start", Arrays.asList(Integer.toString(OrcidSearchManager.MAX_SEARCH_START + 20)));
    LocaleManager localeManager = Mockito.mock(LocaleManagerImpl.class);
    Mockito.when(localeManager.resolveMessage(Mockito.anyString())).thenReturn("a message");
    OrcidSecurityManager orcidSecurityManager = Mockito.mock(OrcidSecurityManagerImpl.class);
    Mockito.when(orcidSecurityManager.getClientIdFromAPIRequest()).thenReturn(null);
    PublicV2ApiServiceDelegatorImpl delegator = new PublicV2ApiServiceDelegatorImpl();
    ReflectionTestUtils.setField(delegator, "localeManager", localeManager);
    ReflectionTestUtils.setField(delegator, "orcidSecurityManager", orcidSecurityManager);
    delegator.searchByQuery(params);
}
Also used : PublicV2ApiServiceDelegatorImpl(org.orcid.api.publicV2.server.delegator.impl.PublicV2ApiServiceDelegatorImpl) HashMap(java.util.HashMap) OrcidSecurityManager(org.orcid.core.manager.OrcidSecurityManager) List(java.util.List) ArrayList(java.util.ArrayList) LocaleManager(org.orcid.core.locale.LocaleManager) DBUnitTest(org.orcid.test.DBUnitTest) Test(org.junit.Test)

Aggregations

LocaleManager (org.orcid.core.locale.LocaleManager)6 List (java.util.List)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 OrcidSecurityManager (org.orcid.core.manager.OrcidSecurityManager)4 DBUnitTest (org.orcid.test.DBUnitTest)4 ArrayList (java.util.ArrayList)3 PublicV2ApiServiceDelegatorImpl (org.orcid.api.publicV2.server.delegator.impl.PublicV2ApiServiceDelegatorImpl)3 Arrays (java.util.Arrays)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 IntStream (java.util.stream.IntStream)1 Response (javax.ws.rs.core.Response)1 StringUtils (org.apache.commons.lang3.StringUtils)1 Assert.assertEquals (org.junit.Assert.assertEquals)1 Assert.assertNotNull (org.junit.Assert.assertNotNull)1 Assert.assertNull (org.junit.Assert.assertNull)1 Assert.assertTrue (org.junit.Assert.assertTrue)1 Before (org.junit.Before)1