formatted code in LRUCacheTest.java
[appc.git] / appc-core / appc-common-bundle / src / test / java / org / onap / appc / cache / impl / LRUCacheTest.java
index 2eca72a..1d7e4b4 100644 (file)
@@ -6,6 +6,8 @@
  * ================================================================================
  * Copyright (C) 2017 Amdocs
  * =============================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * =============================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 
 package org.onap.appc.cache.impl;
 
+import java.util.Map;
+
 import org.junit.Assert;
+import org.junit.Before;
 import org.junit.Test;
 import org.powermock.reflect.Whitebox;
 
-import java.util.Map;
-
 public class LRUCacheTest {
 
+    private LRUCache cache;
+
+    @Before
+    public void setUp() {
+        cache = new LRUCache(20);
+    }
+
     @Test
     public void testConstructor() throws Exception {
-        LRUCache cache = new LRUCache(20);
         Map internalMap = Whitebox.getInternalState(cache, "map");
         Assert.assertTrue(internalMap != null);
         Assert.assertTrue(internalMap.size() == 0);
@@ -41,8 +50,6 @@ public class LRUCacheTest {
 
     @Test
     public void testGetAndPutObject() throws Exception {
-        LRUCache cache = new LRUCache(20);
-
         String key = "testing key";
         Assert.assertTrue(cache.getObject(key) == null);