Lint implements TestRule { public List<Warning> files(@NonNull String... files) throws Exception { wrapper.analyze(detector, Arrays.asList(issues), files); return wrapper.getWarnings(); } Lint(@NonNull Detector detector, @NonNull Issue... issues); @Override Statement apply(Statement base, Description description); List<Warning> files(@NonNull String... files); List<Warning> project(TestFile... files);  }
@Test public void shouldAnalyzeExternalResourceAndReturnWarnings() throws Exception { String[] files = { "file" }; Detector detector = Helper.dummyDetector(); Issue[] issues = { Helper.dummyIssue() }; Lint lint = new Lint(detector, issues); List<Warning> warnings = lint.files(files); assertThat(warnings).isEqualTo(Helper.dummyWarnings()); }