Skip to content

Commit d443efa

Browse files
committed
fixes matyb#33
1 parent bb1a863 commit d443efa

3 files changed

Lines changed: 20 additions & 17 deletions

File tree

koans/app/config/config.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
compile_timeout_in_ms=5000
2-
ignore_from_monitoring=.*\\.idea
2+
ignore_from_monitoring=(.*\\.idea|^\\.#.*\\..*|^#.*\\..*)
33
debug=false
44
exit_character=Q
55
enable_encouragement=false

lib/src/main/java/com/sandwich/util/io/StreamUtils.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@
77
public class StreamUtils {
88

99
public static String convertStreamToString(InputStream stream) {
10+
Scanner scanner = new Scanner(stream);
1011
try {
11-
return new Scanner(stream).useDelimiter("\\A").next();
12+
return scanner.useDelimiter("\\A").next();
1213
} catch (NoSuchElementException e) {
1314
return "";
15+
} finally {
16+
scanner.close();
1417
}
1518
}
1619

lib/src/test/java/com/sandwich/util/KoanComparatorTest.java

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,20 +44,20 @@ public void testComparatorRanksByOrder() throws Exception {
4444
assertSame(m2,methods.get(1));
4545
}
4646

47-
@Test
48-
public void testVariableNamesArentConfusedAsKoanMethodsWhenSorting() throws Exception {
49-
Class<? extends Object> clazz = new Object(){
50-
String foo;
51-
@Koan public void bar(){}
52-
@Koan public void foo(){}
53-
}.getClass();
54-
KoanMethod m1 = KoanMethod.getInstance("", clazz.getDeclaredMethod("bar"));
55-
KoanMethod m2 = KoanMethod.getInstance("", clazz.getDeclaredMethod("foo"));
56-
List<KoanMethod> methods = Arrays.asList(m2,m1);
57-
Collections.sort(methods, new KoanComparator());
58-
assertSame(m1,methods.get(0));
59-
assertSame(m2,methods.get(1));
60-
}
61-
47+
@Test
48+
public void testVariableNamesArentConfusedAsKoanMethodsWhenSorting() throws Exception {
49+
Class<? extends Object> clazz = new Object(){
50+
@SuppressWarnings("unused")
51+
String foo;
52+
@Koan public void bar(){}
53+
@Koan public void foo(){}
54+
}.getClass();
55+
KoanMethod m1 = KoanMethod.getInstance("", clazz.getDeclaredMethod("bar"));
56+
KoanMethod m2 = KoanMethod.getInstance("", clazz.getDeclaredMethod("foo"));
57+
List<KoanMethod> methods = Arrays.asList(m2,m1);
58+
Collections.sort(methods, new KoanComparator());
59+
assertSame(m1,methods.get(0));
60+
assertSame(m2,methods.get(1));
61+
}
6262
}
6363

0 commit comments

Comments
 (0)