### Question:
AiaDataLoaderFactory implements DataLoaderFactory { @Override public DataLoader create() { if (configuration.getAiaDataLoaderFactory() == null) { return createDataLoader(); } else { logger.debug("Using custom AIA data loader factory provided by the configuration"); return configuration.getAiaDataLoaderFactory().create(); } } AiaDataLoaderFactory(Configuration configuration, String userAgent); @Override DataLoader create();  }### Answer:
@Test public void testDefaultAiaDataLoaderCreatedWhenNoCustomDataLoaderFactoryConfigured() { configuration.setConnectionTimeout(2345); configuration.setSocketTimeout(1234); DataLoader dataLoader = new AiaDataLoaderFactory(configuration, USER_AGENT_STRING).create(); Assert.assertTrue("Data loader should be of type " + SimpleHttpGetDataLoader.class.getSimpleName(), dataLoader instanceof SimpleHttpGetDataLoader); Assert.assertEquals(5, ((SimpleHttpGetDataLoader) dataLoader).getFollowRedirects()); Assert.assertEquals(USER_AGENT_STRING, ((SimpleHttpGetDataLoader) dataLoader).getUserAgent()); Assert.assertEquals(2345, ((SimpleHttpGetDataLoader) dataLoader).getConnectTimeout()); Assert.assertEquals(1234, ((SimpleHttpGetDataLoader) dataLoader).getReadTimeout()); }
@Test public void testCustomDataLoaderCreatedWhenCustomDataLoaderConfigured() { DataLoader mockDataLoader = Mockito.mock(DataLoader.class); DataLoaderFactory mockDataLoaderFactory = Mockito.mock(DataLoaderFactory.class); Mockito.doReturn(mockDataLoader).when(mockDataLoaderFactory).create(); configuration.setAiaDataLoaderFactory(mockDataLoaderFactory); DataLoader dataLoader = new AiaDataLoaderFactory(configuration, USER_AGENT_STRING).create(); Assert.assertSame(mockDataLoader, dataLoader); Mockito.verify(mockDataLoaderFactory, Mockito.times(1)).create(); Mockito.verifyNoMoreInteractions(mockDataLoaderFactory, mockDataLoader); }