mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AssertWithSideEffects: tests fixed (HashSet/TreeSet are absent in mockJDK7, so locality-based tests were not testing anything actually)
This commit is contained in:
-8
@@ -30,12 +30,4 @@ public class AssertWithSideEffects {
|
||||
void jdbc(ResultSet rs) throws SQLException {
|
||||
assert rs.last();
|
||||
}
|
||||
|
||||
void assertMutation(Set<String> set) {
|
||||
assert set.add("foo");
|
||||
|
||||
assert new HashSet<>().add("bar");
|
||||
|
||||
assert (set.isEmpty() ? new TreeSet<>() : new HashSet<>()).add("baz");
|
||||
}
|
||||
}
|
||||
-7
@@ -20,11 +20,4 @@
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'assert' statement with side effects</problem_class>
|
||||
<description><code>assert</code> has side effects #loc</description>
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>AssertWithSideEffects.java</file>
|
||||
<line>35</line>
|
||||
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'assert' statement with side effects</problem_class>
|
||||
<description><code>assert</code> has side effects #loc</description>
|
||||
</problem>
|
||||
</problems>
|
||||
+9
@@ -1,5 +1,6 @@
|
||||
package com.siyeh.igtest.bugs.assert_with_side_effects;
|
||||
import java.util.regex.*;
|
||||
import java.util.*;
|
||||
public class AssertWithSideEffects {
|
||||
void assertMutation() {
|
||||
Matcher m = Pattern.compile("foobar").matcher("foo");
|
||||
@@ -7,4 +8,12 @@ public class AssertWithSideEffects {
|
||||
|
||||
assert Pattern.compile("foobar").matcher("foo").matches();
|
||||
}
|
||||
|
||||
void assertMutation(Set<String> set) {
|
||||
assert set.add("foo");
|
||||
|
||||
assert new HashSet<>().add("bar");
|
||||
|
||||
assert (set.isEmpty() ? new TreeSet<>() : new HashSet<>()).add("baz");
|
||||
}
|
||||
}
|
||||
+7
-1
@@ -2,7 +2,13 @@
|
||||
<problems>
|
||||
<problem>
|
||||
<file>AssertWithSideEffects.java</file>
|
||||
<line>6</line>
|
||||
<line>7</line>
|
||||
<problem_class>'assert' statement with side effects</problem_class>
|
||||
<description><code>assert</code> has side effects #loc</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>AssertWithSideEffects.java</file>
|
||||
<line>13</line>
|
||||
<problem_class>'assert' statement with side effects</problem_class>
|
||||
<description><code>assert</code> has side effects #loc</description>
|
||||
</problem>
|
||||
|
||||
Reference in New Issue
Block a user