1. Shuji Watanabe
  2. tddbc-sapporo

Commits

shuji.w6e  committed 501b349

add indexOf_notExistKey test

  • Participants
  • Parent commits 564aa81
  • Branches default

Comments (0)

Files changed (2)

File src/main/java/tddbc/LRUCache.java

View file
     }
 
     public int indexOf(String key) {
-        return 0;
+        return container.containsKey(key) ? 0 : -1;
     }
 
 }

File src/test/java/tddbc/LRUCacheTest.java

View file
         target.put("a", "dataA");
         assertThat(target.indexOf("a"), is(0));
     }
+
+    @Test
+    public void indexOf_notExistKey() throws Exception {
+        assertThat(target.indexOf("a"), is(-1));
+    }
 }