Example usage for com.liferay.portal.model.impl RegionImpl RegionImpl

List of usage examples for com.liferay.portal.model.impl RegionImpl RegionImpl

Introduction

In this page you can find the example usage for com.liferay.portal.model.impl RegionImpl RegionImpl.

Prototype

RegionImpl

Source Link

Usage

From source file:com.liferay.content.targeting.rule.ip.geocode.IpGeocodeRuleTest.java

License:Open Source License

@Test
public void testMadrid() throws Exception {
    Country country = new CountryImpl();

    country.setA2("ES");

    when(CountryServiceUtil.fetchCountry(Mockito.anyLong())).thenReturn(country);

    Region region = new RegionImpl();

    region.setName("Madrid");

    when(RegionServiceUtil.getRegion(Mockito.anyLong())).thenReturn(region);

    when(_ipInfo.getCountryCode()).thenReturn("ES");

    when(_ipInfo.getRegionName()).thenReturn("Madrid");

    when(_ipGeocoder.getIPInfo(Mockito.anyString())).thenReturn(_ipInfo);

    Assert.assertTrue(_ipGeocodeRule.evaluate(null, _ruleInstance, _anonymousUser));
}

From source file:com.liferay.contenttargeting.rules.ipgeocode.IpGeocodeRuleTest.java

License:Open Source License

@Test
public void testMadrid() throws Exception {
    Country country = new CountryImpl();

    country.setA2("ES");

    when(CountryServiceUtil.fetchCountry(Mockito.anyLong())).thenReturn(country);

    Region region = new RegionImpl();

    region.setName("Madrid");

    when(RegionServiceUtil.getRegion(Mockito.anyLong())).thenReturn(region);

    when(_ipInfo.getCountryCode()).thenReturn("ES");

    when(_ipInfo.getRegion()).thenReturn("Madrid");

    when(_ipGeocoder.getIPInfo(Mockito.anyString())).thenReturn(_ipInfo);

    Assert.assertTrue(_ipGeocodeRule.evaluate(null, _ruleInstance, _anonymousUser));
}