### Question:
JpaRegionRepository implements RegionRepository { @Override public Region save(Region item) { JpaRegion region = regionConverter.convert(item); return saveOrUpdate(region.getEntityId(), manager, region); }  @Override Class<? extends Region> getType(); @Override Region get(String id); @Override Region save(Region item); @Override void delete(Region item); @Override List<Region> getAll(); @Override List<Region> getLimitedList(int offset, int pageSize); @Override int getCountAll();  }### Answer:
@Test @Rollback(true) public void save_newEntity() { JpaRegion region = new JpaRegion(); region.setRegionWidgets(new ArrayList<RegionWidget>()); JpaRegion saved = (JpaRegion)repository.save(region); manager.flush(); assertThat(saved, is(sameInstance(region))); assertThat(saved.getEntityId(), is(notNullValue())); }
@Test @Rollback(true) public void save_existingEntity() { JpaRegion region = new JpaRegion(); region.setEntityId(1L); region.setRegionWidgets(new ArrayList<RegionWidget>()); JpaRegion saved = (JpaRegion)repository.save(region); manager.flush(); assertThat(saved, is(not(sameInstance(region)))); assertThat(saved.getEntityId(), is(equalTo(region.getEntityId()))); }