### Question:
RepositoryDirectoryUI { protected static List<RepositoryElementMetaInterface> loadRepositoryObjects( RepositoryDirectoryInterface dir, boolean getTransformations, boolean getJobs, Repository rep ) throws KettleDatabaseException { List<RepositoryElementMetaInterface> repositoryObjects = new ArrayList<RepositoryElementMetaInterface>(); if ( dir.getRepositoryObjects() == null ) { try { dir.setRepositoryObjects( rep.getJobAndTransformationObjects( dir.getObjectId(), false ) ); } catch ( KettleException e ) { throw new KettleDatabaseException( e ); } } List<RepositoryObjectType> allowedTypes = new ArrayList<>( 2 ); if ( getTransformations ) { allowedTypes.add( RepositoryObjectType.TRANSFORMATION ); } if ( getJobs ) { allowedTypes.add( RepositoryObjectType.JOB ); } for ( RepositoryElementMetaInterface repoObject : dir.getRepositoryObjects() ) { if ( allowedTypes.contains( repoObject.getObjectType() ) ) { repositoryObjects.add( repoObject ); } } return repositoryObjects; }  static void getTreeWithNames( TreeItem ti, Repository rep, Color dircolor, int sortPosition,
    boolean includeDeleted, boolean ascending, boolean getTransformations, boolean getJobs,
    RepositoryDirectoryInterface dir, String filterString, Pattern pattern ); static void getDirectoryTree( TreeItem ti, Color dircolor, RepositoryDirectoryInterface dir ); static RepositoryDirectoryInterface chooseDirectory( Shell shell, Repository rep, RepositoryDirectoryInterface directoryFrom );  }### Answer:
@Test public void testLoadRepositoryObjectsFilled() throws Exception { RepositoryDirectory root = new RepositoryDirectory(); root.setObjectId( new LongObjectId( 0L ) ); RepositoryDirectory dir = new RepositoryDirectory(); dir.setObjectId( new LongObjectId( 1L ) ); root.addSubdirectory( dir ); RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class ); when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION ); root.setRepositoryObjects( Collections.emptyList() ); dir.setRepositoryObjects( Collections.singletonList( meta ) ); Repository repo = mock( Repository.class ); assertTrue( RepositoryDirectoryUI.loadRepositoryObjects( root, true, true, repo ).isEmpty() ); assertEquals( 1, RepositoryDirectoryUI.loadRepositoryObjects( dir, true, true, repo ).size() ); verifyZeroInteractions( repo ); }
@Test public void testLoadRepositoryObjectsNulled() throws Exception { RepositoryDirectory root = new RepositoryDirectory(); root.setObjectId( new LongObjectId( 0L ) ); RepositoryDirectory dir = new RepositoryDirectory(); dir.setObjectId( new LongObjectId( 1L ) ); root.addSubdirectory( dir ); RepositoryElementMetaInterface meta = mock( RepositoryElementMetaInterface.class ); when( meta.getObjectType() ).thenReturn( RepositoryObjectType.TRANSFORMATION ); Repository repo = mock( Repository.class ); when( repo.getJobAndTransformationObjects( dir.getObjectId(), false ) ).thenReturn( Collections.singletonList( meta ) ); when( repo.getJobAndTransformationObjects( root.getObjectId(), false ) ).thenReturn( Collections.emptyList() ); assertTrue( RepositoryDirectoryUI.loadRepositoryObjects( root, true, true, repo ).isEmpty() ); assertEquals( 1, RepositoryDirectoryUI.loadRepositoryObjects( dir, true, true, repo ).size() ); }