diff --git a/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java b/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java new file mode 100644 index 00000000000..a767df98b40 --- /dev/null +++ b/findbugs/src/test/java/edu/umd/cs/findbugs/detect/FindUnsatisfiedObligationTest.java @@ -0,0 +1,22 @@ +package edu.umd.cs.findbugs.detect; + +import static org.junit.Assert.assertThat; + +import static org.hamcrest.core.Is.is; + +import static org.hamcrest.collection.IsEmptyIterable.*; +import org.junit.Test; + +import edu.umd.cs.findbugs.AbstractIntegrationTest; + +public class FindUnsatisfiedObligationTest extends AbstractIntegrationTest { + /** + * @see GitHub + * issue + */ + @Test + public void testIssue60() { + performAnalysis("Issue60.class"); + assertThat(getBugCollection(), is(emptyIterable())); + } +} diff --git a/findbugsTestCases/src/java/Issue60.java b/findbugsTestCases/src/java/Issue60.java new file mode 100644 index 00000000000..b79f1b8f447 --- /dev/null +++ b/findbugsTestCases/src/java/Issue60.java @@ -0,0 +1,22 @@ +import java.io.IOException; +import java.io.InputStream; +import java.net.URL; +import java.util.Properties; +import java.util.stream.Stream; + +public class Issue60 { + + public static void create(URL url) { + try (InputStream in = url.openStream()) { + Properties p1 = new Properties(); + p1.load(in); + } catch (IOException e) { + } + } + + public Stream keys() { + return Stream. of() + .flatMap(p -> p.stringPropertyNames().stream()); + } + +}