@Test void testHasEntitiesTrue() { String entityTypeId = "EntityTypeId"; EntityType entityType = when(mock(EntityType.class).getId()).thenReturn(entityTypeId).getMock(); RepositoryCollection repositoryCollection = mock(RepositoryCollection.class); when(repositoryCollection.hasRepository(entityType)).thenReturn(true); when(emxImportJob.getSource()).thenReturn(repositoryCollection); assertTrue(emxDataProvider.hasEntities(entityType)); }
@Override public boolean hasEntities(EntityType entityType) { if (job.getSource().hasRepository(entityType)) { return true; } else { Optional<String> packageId = job.getPackageId(); return packageId.isPresent() && entityType.getId().startsWith(packageId.get() + PACKAGE_SEPARATOR) && job.getSource() .hasRepository( entityType .getId() .substring(packageId.get().length() + PACKAGE_SEPARATOR.length())); } }
EmxDataProvider implements DataProvider { @Override public boolean hasEntities(EntityType entityType) { if (job.getSource().hasRepository(entityType)) { return true; } else { Optional<String> packageId = job.getPackageId(); return packageId.isPresent() && entityType.getId().startsWith(packageId.get() + PACKAGE_SEPARATOR) && job.getSource() .hasRepository( entityType .getId() .substring(packageId.get().length() + PACKAGE_SEPARATOR.length())); } } }
EmxDataProvider implements DataProvider { @Override public boolean hasEntities(EntityType entityType) { if (job.getSource().hasRepository(entityType)) { return true; } else { Optional<String> packageId = job.getPackageId(); return packageId.isPresent() && entityType.getId().startsWith(packageId.get() + PACKAGE_SEPARATOR) && job.getSource() .hasRepository( entityType .getId() .substring(packageId.get().length() + PACKAGE_SEPARATOR.length())); } } EmxDataProvider(EmxImportJob job, EntityManager entityManager); }
EmxDataProvider implements DataProvider { @Override public boolean hasEntities(EntityType entityType) { if (job.getSource().hasRepository(entityType)) { return true; } else { Optional<String> packageId = job.getPackageId(); return packageId.isPresent() && entityType.getId().startsWith(packageId.get() + PACKAGE_SEPARATOR) && job.getSource() .hasRepository( entityType .getId() .substring(packageId.get().length() + PACKAGE_SEPARATOR.length())); } } EmxDataProvider(EmxImportJob job, EntityManager entityManager); @Override Stream<EntityType> getEntityTypes(); @Override boolean hasEntities(EntityType entityType); @Override Stream<Entity> getEntities(EntityType entityType); }
EmxDataProvider implements DataProvider { @Override public boolean hasEntities(EntityType entityType) { if (job.getSource().hasRepository(entityType)) { return true; } else { Optional<String> packageId = job.getPackageId(); return packageId.isPresent() && entityType.getId().startsWith(packageId.get() + PACKAGE_SEPARATOR) && job.getSource() .hasRepository( entityType .getId() .substring(packageId.get().length() + PACKAGE_SEPARATOR.length())); } } EmxDataProvider(EmxImportJob job, EntityManager entityManager); @Override Stream<EntityType> getEntityTypes(); @Override boolean hasEntities(EntityType entityType); @Override Stream<Entity> getEntities(EntityType entityType);  }