@@ -0,0 +1,2580 @@
+package org.sagebionetworks;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.mockito.Mockito.never;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.mockito.Mockito.when;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0Aimport org.junit.runner.RunWith;%0Aimport org.mockito.Mock;%0Aimport org.mockito.runners.MockitoJUnitRunner;%0A%0A/**%0A *  To test methods in StackConfigurationImpl that are not directly related to the stack%0A *%0A *  This class is missing a lot of tests! Please add them :)%0A */%0A@RunWith(MockitoJUnitRunner.class)%0Apublic class StackConfigurationImplUnitTest %7B%0A%09%0A%09StackConfigurationImpl config;%0A%0A%09@Mock%0A%09ConfigurationProperties mockProperties;%0A%09%0A%09@Before%0A%09public void before() %7B%0A%09%09this.config = new StackConfigurationImpl(mockProperties);%0A%09%7D%0A%0A%09@Test%0A%09public void testGetDoiPrefixOnProd() %7B%0A%09%09String stackName = %22prod%22;%0A%09%09String prefix = %22a prefix%22;%0A%09%09when(mockProperties.getProperty(StackConstants.STACK_PROPERTY_NAME)).thenReturn(stackName); // config.isProduction() will return true%0A%09%09String doiPrefixPropertyName = %22org.sagebionetworks.doi.prefix%22;%0A%09%09when(mockProperties.getProperty(DOI_PREFIX_PROPERTY)).thenReturn(prefix);%0A%0A%09%09// Call under test%0A%09%09String actualPrefix = config.getDoiPrefix();%0A%0A%09%09assertEquals(prefix, actualPrefix);%0A%09%09verify(mockProperties).getProperty(StackConstants.STACK_PROPERTY_NAME);%0A%09%09verify(mockProperties, never()).getProperty(StackConstants.STACK_INSTANCE_PROPERTY_NAME);%0A%09%09verify(mockProperties).getProperty(doiPrefixPropertyName);%0A%0A%09%7D%0A%0A%09@Test%0A%09public void testGetDoiPrefixNotOnProd() %7B%0A%09%09String stackPropertyName = %22testNotProd%22;%0A%09%09String stackInstancePropertyName = %22testStack%22;%0A%09%09String prefix = %22a prefix%22;%0A%09%09when(mockProperties.getProperty(StackConstants.STACK_PROPERTY_NAME)).thenReturn(stackPropertyName); // config.isProduction() will return false%0A%09%09when(mockProperties.getProperty(StackConstants.STACK_INSTANCE_PROPERTY_NAME)).thenReturn(stackInstancePropertyName);%0A%09%09String doiPrefixPropertyName = %22org.sagebionetworks.doi.prefix%22;%0A%09%09when(mockProperties.getProperty(doiPrefixPropertyName)).thenReturn(prefix);%0A%0A%09%09String expectedPrefix = prefix + %22/%22 + stackInstancePropertyName;%0A%0A%09%09// Call under test%0A%09%09String actualPrefix = config.getDoiPrefix();%0A%0A%09%09assertEquals(expectedPrefix, actualPrefix);%0A%09%09verify(mockProperties).getProperty(StackConstants.STACK_PROPERTY_NAME);%0A%09%09verify(mockProperties).getProperty(StackConstants.STACK_INSTANCE_PROPERTY_NAME);%0A%09%09verify(mockProperties).getProperty(doiPrefixPropertyName);%0A%09%7D%0A%0A%0A%09private static final String DOI_PREFIX_PROPERTY = %22org.sagebionetworks.doi.prefix%22;%0A%7D%0A

add a stackconfigurationimpl unit test class