@Test public void testGetIdForString() { System.out.println("getIdForString"); String s = "not in the testfile"; String result = instance.getIdForString(s); assertEquals(null, result); result = instance.getIdForString("this is a test"); assertEquals("test", result); result = instance.getIdForString("also a test"); assertEquals("test2", result); instance.getStringFromID(null); }
public String getIdForString(String s) { if (idsToString.containsValue(s)) { for (Entry<String, String> entry : idsToString.entrySet()) { if (Objects.equals(s.toLowerCase(), entry.getValue().toLowerCase())) { return entry.getKey(); } } } return null; }
StringResourceLoader { public String getIdForString(String s) { if (idsToString.containsValue(s)) { for (Entry<String, String> entry : idsToString.entrySet()) { if (Objects.equals(s.toLowerCase(), entry.getValue().toLowerCase())) { return entry.getKey(); } } } return null; } }
StringResourceLoader { public String getIdForString(String s) { if (idsToString.containsValue(s)) { for (Entry<String, String> entry : idsToString.entrySet()) { if (Objects.equals(s.toLowerCase(), entry.getValue().toLowerCase())) { return entry.getKey(); } } } return null; } StringResourceLoader(LinkedList<String> stringRes); }
StringResourceLoader { public String getIdForString(String s) { if (idsToString.containsValue(s)) { for (Entry<String, String> entry : idsToString.entrySet()) { if (Objects.equals(s.toLowerCase(), entry.getValue().toLowerCase())) { return entry.getKey(); } } } return null; } StringResourceLoader(LinkedList<String> stringRes); String getStringFromID(String id); String getIdForString(String s); boolean containsId(String id); }
StringResourceLoader { public String getIdForString(String s) { if (idsToString.containsValue(s)) { for (Entry<String, String> entry : idsToString.entrySet()) { if (Objects.equals(s.toLowerCase(), entry.getValue().toLowerCase())) { return entry.getKey(); } } } return null; } StringResourceLoader(LinkedList<String> stringRes); String getStringFromID(String id); String getIdForString(String s); boolean containsId(String id);  }