@@ -0,0 +1,2817 @@
+package org.datacite.mds.util;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNull;%0Aimport static org.junit.Assert.assertTrue;%0A%0Aimport java.util.Arrays;%0Aimport java.util.SortedSet;%0Aimport java.util.TreeSet;%0A%0Aimport javax.validation.constraints.AssertTrue;%0A%0Aimport org.apache.commons.collections.CollectionUtils;%0Aimport org.apache.commons.collections.SetUtils;%0Aimport org.datacite.mds.domain.Allocator;%0Aimport org.datacite.mds.domain.AllocatorOrDatacentre;%0Aimport org.datacite.mds.domain.Datacentre;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.springframework.test.context.ContextConfiguration;%0Aimport org.springframework.test.context.junit4.SpringJUnit4ClassRunner;%0Aimport org.springframework.transaction.annotation.Transactional;%0A%0A@RunWith(SpringJUnit4ClassRunner.class)%0A@ContextConfiguration(%22/META-INF/spring/applicationContext.xml%22)%0A@Transactional%0Apublic class DomainUtilsTest %7B%0A%0A    String ALLOCATOR1_SYMBOL = %22AL1%22;%0A    String ALLOCATOR2_SYMBOL = %22AL2%22;%0A    String DATACENTRE1_SYMBOL = %22AL1.DC1%22;%0A    String DATACENTRE2_SYMBOL = %22AL1.DC2%22;%0A    String OTHER_SYMBOL = %22AL42%22;%0A    %0A    Allocator allocator1, allocator2;%0A    Datacentre datacentre1, datacentre2;%0A%0A    @Before%0A    public void init() %7B%0A        allocator1 = org.datacite.mds.test.Utils.createAllocator(ALLOCATOR1_SYMBOL);%0A        allocator1.persist();%0A        allocator2 = org.datacite.mds.test.Utils.createAllocator(ALLOCATOR2_SYMBOL);%0A        allocator2.persist();%0A        datacentre1 = org.datacite.mds.test.Utils.createDatacentre(DATACENTRE1_SYMBOL, allocator1);%0A        datacentre1.persist();%0A        datacentre2 = org.datacite.mds.test.Utils.createDatacentre(DATACENTRE2_SYMBOL, allocator1);%0A        datacentre2.persist();%0A    %7D%0A%0A    @Test%0A    public void testFindAllocatorOrDatacentreBySymbol() %7B%0A        AllocatorOrDatacentre user;%0A%0A        user = DomainUtils.findAllocatorOrDatacentreBySymbol(ALLOCATOR1_SYMBOL);%0A        assertEquals(ALLOCATOR1_SYMBOL, user.getSymbol());%0A%0A        user = DomainUtils.findAllocatorOrDatacentreBySymbol(DATACENTRE2_SYMBOL);%0A        assertEquals(DATACENTRE2_SYMBOL, user.getSymbol());%0A    %7D%0A%0A    @Test%0A    public void testFindAllocatorOrDatacentreBySymbol_Null() %7B%0A        assertNull(DomainUtils.findAllocatorOrDatacentreBySymbol(OTHER_SYMBOL));%0A    %7D%0A%0A    @Test%0A    public void testGetAllSymbols() %7B%0A        SortedSet%3CString%3E retrievedSymbols = DomainUtils.getAllSymbols();%0A        SortedSet%3CString%3E expectedSymbols = new TreeSet%3CString%3E();%0A        expectedSymbols.add(DATACENTRE1_SYMBOL);%0A        expectedSymbols.add(DATACENTRE2_SYMBOL);%0A        expectedSymbols.add(ALLOCATOR1_SYMBOL);%0A        expectedSymbols.add(ALLOCATOR2_SYMBOL);%0A        %0A        assertTrue(SetUtils.isEqualSet(expectedSymbols, retrievedSymbols));%0A    %7D%0A%7D%0A

add test for DomainUtils