@Test void testUpdateEntitiesExist() { Attribute idAttr = mock(Attribute.class); when(idAttr.getName()).thenReturn("attr"); when(idAttr.getDataType()).thenReturn(STRING); when(entityType.getIdAttribute()).thenReturn(idAttr); when(entityType.getAtomicAttributes()).thenReturn(singletonList(idAttr)); when(entityType.getId()).thenReturn("entity"); Entity entity0 = mock(Entity.class); Entity entity1 = mock(Entity.class); when(jdbcTemplate.batchUpdate(any(String.class), any(BatchPreparedStatementSetter.class))) .thenReturn(new int[] {2}); postgreSqlRepo.update(Stream.of(entity0, entity1)); verify(jdbcTemplate).batchUpdate(any(String.class), any(BatchPreparedStatementSetter.class)); verifyNoMoreInteractions(jdbcTemplate); }
@Override public void update(Entity entity) { update(Stream.of(entity)); }
PostgreSqlRepository extends AbstractRepository { @Override public void update(Entity entity) { update(Stream.of(entity)); } }
PostgreSqlRepository extends AbstractRepository { @Override public void update(Entity entity) { update(Stream.of(entity)); } PostgreSqlRepository(
      PostgreSqlEntityFactory postgreSqlEntityFactory,
      JdbcTemplate jdbcTemplate,
      DataSource dataSource,
      EntityType entityType); }
PostgreSqlRepository extends AbstractRepository { @Override public void update(Entity entity) { update(Stream.of(entity)); } PostgreSqlRepository(
      PostgreSqlEntityFactory postgreSqlEntityFactory,
      JdbcTemplate jdbcTemplate,
      DataSource dataSource,
      EntityType entityType); @Override Iterator<Entity> iterator(); @Override Set<RepositoryCapability> getCapabilities(); @Override Set<Operator> getQueryOperators(); @Override EntityType getEntityType(); @Override long count(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Entity findOneById(Object id); @Override Entity findOneById(Object id, Fetch fetch); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void delete(Entity entity); @Override void delete(Stream<Entity> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize); }
PostgreSqlRepository extends AbstractRepository { @Override public void update(Entity entity) { update(Stream.of(entity)); } PostgreSqlRepository(
      PostgreSqlEntityFactory postgreSqlEntityFactory,
      JdbcTemplate jdbcTemplate,
      DataSource dataSource,
      EntityType entityType); @Override Iterator<Entity> iterator(); @Override Set<RepositoryCapability> getCapabilities(); @Override Set<Operator> getQueryOperators(); @Override EntityType getEntityType(); @Override long count(Query<Entity> q); @Override Stream<Entity> findAll(Query<Entity> q); @Override Entity findOne(Query<Entity> q); @Override Entity findOneById(Object id); @Override Entity findOneById(Object id, Fetch fetch); @Override void update(Entity entity); @Override void update(Stream<Entity> entities); @Override void delete(Entity entity); @Override void delete(Stream<Entity> entities); @Override void deleteById(Object id); @Override void deleteAll(Stream<Object> ids); @Override void deleteAll(); @Override void add(Entity entity); @Override Integer add(Stream<Entity> entities); @Override void forEachBatched(Fetch fetch, Consumer<List<Entity>> consumer, int batchSize);  }