ExcludeSuppressed implements Nulls { @Override public List<Null> asList() { final List<Null> filtered = new ArrayList<>(); for (final Null nil : origin.asList()) { if (!nil.isSuppressed()) { filtered.add(nil); } } return filtered; } ExcludeSuppressed(final Nulls origin); @Override List<Null> asList();  }
@Test public void emptyNullsWhenSuppressed() throws Exception { Assert.assertThat( new ExcludeSuppressed( new JavaSourceFile( "class A {\n", " void method() {\n", " @SuppressWarnings(\"nullfree\")\n", " String name = null;\n", " }\n", "}\n" ).nulls() ).asList().isEmpty(), IsEqual.equalTo(true) ); }
@Test public void asd() throws Exception { Assert.assertThat( new ExcludeSuppressed( new JavaSourceFile( "class A {\n", " @Override\n", " @SuppressWarnings(\"nullfree\")\n", " void method() {\n", " String name = \"asd\";\n", " if (name == null) {}\n", " }\n", "}\n" ).nulls() ).asList().isEmpty(), IsEqual.equalTo(true) ); }