public void lookupRepositoryReferences( Repository repository ) throws KettleException {
    KettleException lastThrownException = null;
    Map<String, RepositoryObjectType> notFoundedReferences = new HashMap<>();
    for ( JobEntryCopy copy : jobcopies ) {
      if ( copy.getEntry().hasRepositoryReferences() ) {
        try {
          copy.getEntry().lookupRepositoryReferences( repository );
        } catch ( IdNotFoundException e ) {
          lastThrownException = e;
          String path = e.getPathToObject();
          String name = e.getObjectName();
          String key = StringUtils.isEmpty( path ) || path.equals( "null" ) ? name : path + "/" + name;
          notFoundedReferences.put( key, e.getObjectType() );
        }
      }
    }
    if ( lastThrownException != null && !notFoundedReferences.isEmpty() ) {
      throw new LookupReferencesException( lastThrownException, notFoundedReferences );
    }
  }
@Test
  public void testLookupRepositoryReferences() throws Exception {
    jobMeta.clear();

    JobEntryTrans jobEntryMock = mock( JobEntryTrans.class );
    when( jobEntryMock.hasRepositoryReferences() ).thenReturn( true );

    JobEntryTrans brokenJobEntryMock = mock( JobEntryTrans.class );
    when( brokenJobEntryMock.hasRepositoryReferences() ).thenReturn( true );
    doThrow( mock( IdNotFoundException.class ) ).when( brokenJobEntryMock ).lookupRepositoryReferences( any(
        Repository.class ) );

    JobEntryCopy jobEntryCopy1 = mock( JobEntryCopy.class );
    when( jobEntryCopy1.getEntry() ).thenReturn( jobEntryMock );
    jobMeta.addJobEntry( 0, jobEntryCopy1 );

    JobEntryCopy jobEntryCopy2 = mock( JobEntryCopy.class );
    when( jobEntryCopy2.getEntry() ).thenReturn( brokenJobEntryMock );
    jobMeta.addJobEntry( 1, jobEntryCopy2 );

    JobEntryCopy jobEntryCopy3 = mock( JobEntryCopy.class );
    when( jobEntryCopy3.getEntry() ).thenReturn( jobEntryMock );
    jobMeta.addJobEntry( 2, jobEntryCopy3 );

    try {
      jobMeta.lookupRepositoryReferences( mock( Repository.class ) );
      fail( "no exception for broken entry" );
    } catch ( LookupReferencesException e ) {
      // ok
    }
    verify( jobEntryMock, times( 2 ) ).lookupRepositoryReferences( any( Repository.class ) );
  }