use of com.marklogic.client.ForbiddenUserException in project components by Talend.
the class MarkLogicSourceOrSinkTest method testValidateCannotConnect.
@Test
public void testValidateCannotConnect() {
DatabaseClient mockedClient = mock(DatabaseClient.class);
when(mockedClient.openTransaction()).thenThrow(new ForbiddenUserException("User not allowed"));
PowerMockito.mockStatic(DatabaseClientFactory.class);
when(DatabaseClientFactory.newClient(anyString(), anyInt(), anyString(), (DatabaseClientFactory.SecurityContext) anyObject())).thenReturn(mockedClient);
MarkLogicInputProperties inputProperties = new MarkLogicInputProperties("inputProperties");
sourceOrSink.initialize(null, inputProperties);
assertEquals(Result.ERROR, sourceOrSink.validate(null).getStatus());
}
Aggregations