Fix unit testing instability
[externalapi/nbi.git] / src / test / java / org / onap / nbi / test / ServiceOrderRepositoryTest.java
  *     See the License for the specific language governing permissions and
  *     limitations under the License.
  */
-package org.onap.nbi.apis;
+package org.onap.nbi.test;
 
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+
 import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
@@ -27,10 +28,15 @@ import org.onap.nbi.apis.serviceorder.model.StateType;
 import org.onap.nbi.apis.serviceorder.repositories.ServiceOrderRepository;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.annotation.DirtiesContext;
+import org.springframework.test.annotation.DirtiesContext.ClassMode;
+import org.springframework.test.context.ActiveProfiles;
 import org.springframework.test.context.junit4.SpringRunner;
 
 @RunWith(SpringRunner.class)
 @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@DirtiesContext(classMode= ClassMode.AFTER_CLASS)
+@ActiveProfiles("test")
 public class ServiceOrderRepositoryTest {
 
     @Autowired