### Question:
ExternalResourceInfoFactory { public static IExternalResourceInfo createDatabaseResource( DatabaseMeta databaseMeta ) { return createDatabaseResource( databaseMeta, DEFAULT_IS_INPUT ); } protected  ExternalResourceInfoFactory(); static IExternalResourceInfo createDatabaseResource( DatabaseMeta databaseMeta ); static IExternalResourceInfo createDatabaseResource( DatabaseMeta databaseMeta, boolean isInput ); static IExternalResourceInfo createResource( ResourceEntry resourceEntry ); static IExternalResourceInfo createResource( ResourceEntry resourceEntry, boolean isInput ); static IExternalResourceInfo createFileResource( FileObject fileObject ); static IExternalResourceInfo createFileResource( FileObject fileObject, boolean isInput ); static IExternalResourceInfo createURLResource( String url ); static IExternalResourceInfo createURLResource( String url, boolean isInput );  }### Answer:
@Test public void testCreateDatabaseResource() throws Exception { DatabaseMeta dbMeta = mock( DatabaseMeta.class ); when( dbMeta.getName() ).thenReturn( "myConnection" ); when( dbMeta.getDescription() ).thenReturn( "Description" ); DatabaseInterface dbInterface = mock( DatabaseInterface.class ); when( dbMeta.getDatabaseInterface() ).thenReturn( dbInterface ); when( dbMeta.getAccessType() ).thenReturn( DatabaseMeta.TYPE_ACCESS_NATIVE ); when( dbMeta.getAccessTypeDesc() ).thenReturn( "Native" ); IExternalResourceInfo resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta ); assertTrue( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(JdbcResourceInfo.class) ); resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta, false ); assertFalse( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(JdbcResourceInfo.class) ); when( dbMeta.getAccessType() ).thenReturn( DatabaseMeta.TYPE_ACCESS_JNDI ); when( dbMeta.getAccessTypeDesc() ).thenReturn( "JNDI" ); resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta ); assertTrue( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(JndiResourceInfo.class) ); resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta, false ); assertFalse( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(JndiResourceInfo.class) ); when( dbMeta.getAccessType() ).thenReturn( DatabaseMeta.TYPE_ACCESS_OCI ); when( dbMeta.getAccessTypeDesc() ).thenReturn( "OCI" ); resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta ); assertTrue( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(OCIResourceInfo.class) ); resourceInfo = ExternalResourceInfoFactory.createDatabaseResource( dbMeta, false ); assertFalse( resourceInfo.isInput() ); assertThat( resourceInfo, instanceOf(OCIResourceInfo.class) ); }