@Test public void testUpdateExisting() throws Exception { long pk = RandomTestUtil.nextLong(); Region newRegion = _persistence.create(pk); newRegion.setMvccVersion(RandomTestUtil.nextLong()); newRegion.setCountryId(RandomTestUtil.nextLong()); newRegion.setRegionCode(RandomTestUtil.randomString()); newRegion.setName(RandomTestUtil.randomString()); newRegion.setActive(RandomTestUtil.randomBoolean()); _persistence.update(newRegion); Region existingRegion = _persistence.findByPrimaryKey(newRegion.getPrimaryKey()); Assert.assertEquals(existingRegion.getMvccVersion(), newRegion.getMvccVersion()); Assert.assertEquals(existingRegion.getRegionId(), newRegion.getRegionId()); Assert.assertEquals(existingRegion.getCountryId(), newRegion.getCountryId()); Assert.assertEquals(existingRegion.getRegionCode(), newRegion.getRegionCode()); Assert.assertEquals(existingRegion.getName(), newRegion.getName()); Assert.assertEquals(existingRegion.getActive(), newRegion.getActive()); }
public String getRegionName() throws PortalException, SystemException { String regionName = null; if (regionId != 0) { try { Region region = RegionServiceUtil.getRegion(regionId); regionName = region.getName().toLowerCase(); } catch (NoSuchRegionException nsre) { if (_log.isWarnEnabled()) { _log.warn(nsre.getMessage()); } } } return regionName; }