@Test
public void failIfRedWhenRed() throws Exception {

    try {
        new SimpleNullfree(
            new SimpleSources(
                Collections.singletonList(
                    new JavaSourceFile(
                        "package simple.pkg;\n",
                        "\n",
                        "class B {\n",
                        "  void a() {\n",
                        "    String foo = null;",
                        "  }\n",
                        "  static class A {\n",
                        "    void b() {\n",
                        "      new Runnable() {\n",
                        "        public void run() {\n",
                        "          String name = null;\n",
                        "        }\n",
                        "      };\n",
                        "    }\n",
                        "  }\n",
                        "}\n"
                    )
                )
            ),
            SimpleBadge::new
        ).badge().failIfRed();
        Assert.fail();
    } catch (NullfreeException e) {
        // green
    }
}