From 4a286829631bd6e69f670ff1ef3e1f22d570b940 Mon Sep 17 00:00:00 2001 From: James Moger <james.moger@gitblit.com> Date: Sat, 22 Oct 2011 09:23:10 -0400 Subject: [PATCH] Fixed null pointer in object cache --- tests/com/gitblit/tests/StringUtilsTest.java | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/tests/com/gitblit/tests/StringUtilsTest.java b/tests/com/gitblit/tests/StringUtilsTest.java index 665b914..489972a 100644 --- a/tests/com/gitblit/tests/StringUtilsTest.java +++ b/tests/com/gitblit/tests/StringUtilsTest.java @@ -103,4 +103,22 @@ assertTrue(strings.get(2).equals("C")); assertTrue(strings.get(3).equals("D")); } + + public void testStringsFromValue2() throws Exception { + List<String> strings = StringUtils.getStringsFromValue("common/* libraries/*"); + assertTrue(strings.size() == 2); + assertTrue(strings.get(0).equals("common/*")); + assertTrue(strings.get(1).equals("libraries/*")); + } + + public void testFuzzyMatching() throws Exception { + assertTrue(StringUtils.fuzzyMatch("12345", "12345")); + assertTrue(StringUtils.fuzzyMatch("AbCdEf", "abcdef")); + assertTrue(StringUtils.fuzzyMatch("AbCdEf", "abc*")); + assertTrue(StringUtils.fuzzyMatch("AbCdEf", "*def")); + assertTrue(StringUtils.fuzzyMatch("AbCdEfHIJ", "abc*hij")); + + assertFalse(StringUtils.fuzzyMatch("123", "12345")); + assertFalse(StringUtils.fuzzyMatch("AbCdEfHIJ", "abc*hhh")); + } } -- Gitblit v1.9.1