@@ -0,0 +1,1752 @@
+package org.openregistry.core.domain.jpa;%0D%0A%0D%0Aimport static org.junit.Assert.*;%0D%0A%0D%0Aimport org.junit.Test;%0D%0Aimport org.openregistry.core.domain.Address;%0D%0Aimport org.openregistry.core.domain.Country;%0D%0Aimport org.openregistry.core.domain.Region;%0D%0Aimport org.openregistry.core.domain.jpa.sor.JpaSorAddressImpl;%0D%0Aimport org.springframework.test.context.ContextConfiguration;%0D%0A%0D%0A@ContextConfiguration(locations = %7B%22classpath:base-integration-tests.xml%22%7D)%0D%0A%0D%0Apublic class JpaSorAddressImplTests %7B%0D%0A%0D%0A%09@Test %0D%0A%09public void testSetValidRegion () %7B%0D%0A%09%09Address sorAddress = new JpaSorAddressImpl();%0D%0A%09%09Region validRegion = new JpaRegionImpl();%0D%0A%09%09%0D%0A%09%09assertNull(%22Region must be null before setting%22, sorAddress.getRegion());%0D%0A%09%09sorAddress.setRegion(validRegion);%0D%0A%09%09assertNotNull(%22Region must not be null after setting%22, sorAddress.getRegion());%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09public void testSetNullRegion () %7B%0D%0A%09%09Address sorAddress = new JpaSorAddressImpl();%0D%0A%09%09Region validRegion = new JpaRegionImpl();%0D%0A%09%09sorAddress.setRegion(validRegion);%0D%0A%09%09%0D%0A%09%09assertNotNull(%22Region must not be null before setting it to null%22, sorAddress.getRegion());%0D%0A%09%09sorAddress.setRegion(null);%0D%0A%09%09assertNull(%22Region must be null after setting it to null%22, sorAddress.getRegion());%0D%0A%09%7D%0D%0A%09%0D%0A    @Test(expected = IllegalArgumentException.class)%0D%0A    public void testSetIncorrectRegionType() %7B%0D%0A    %09%0D%0A%09%09Address sorAddress = new JpaSorAddressImpl();%0D%0A%09%09%0D%0A    %09// This implements Region but is not instance of JpaRegionImpl%0D%0A    %09Region invalidRegion = new Region() %7B%0D%0A%09%09%09public String getName() %7B%0D%0A%09%09%09%09return null;%0D%0A%09%09%09%7D%0D%0A%09%09%09public String getCode() %7B%0D%0A%09%09%09%09return null;%0D%0A%09%09%09%7D%0D%0A%09%09%09public Country getCountry() %7B%0D%0A%09%09%09%09return null;%0D%0A%09%09%09%7D    %09%09%0D%0A    %09%7D;%0D%0A    %09sorAddress.setRegion(invalidRegion);%0D%0A    %7D%0D%0A%7D%0D%0A

Test for OR-346: setting valid, invalid and null region (initial version)