{"action":"created","issue":{"url":"https://api.github.com/repos/JakeWharton/timber/issues/45","labels_url":"https://api.github.com/repos/JakeWharton/timber/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/JakeWharton/timber/issues/45/comments","events_url":"https://api.github.com/repos/JakeWharton/timber/issues/45/events","html_url":"https://github.com/JakeWharton/timber/issues/45","id":61425747,"number":45,"title":"Test Lint checks","user":{"login":"JakeWharton","id":66577,"avatar_url":"https://avatars.githubusercontent.com/u/66577?v=3","gravatar_id":"","url":"https://api.github.com/users/JakeWharton","html_url":"https://github.com/JakeWharton","followers_url":"https://api.github.com/users/JakeWharton/followers","following_url":"https://api.github.com/users/JakeWharton/following{/other_user}","gists_url":"https://api.github.com/users/JakeWharton/gists{/gist_id}","starred_url":"https://api.github.com/users/JakeWharton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JakeWharton/subscriptions","organizations_url":"https://api.github.com/users/JakeWharton/orgs","repos_url":"https://api.github.com/users/JakeWharton/repos","events_url":"https://api.github.com/users/JakeWharton/events{/privacy}","received_events_url":"https://api.github.com/users/JakeWharton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-14T05:17:09Z","updated_at":"2015-04-20T11:59:53Z","closed_at":null,"body":"Copy the official one's mechanism: https://android.googlesource.com/platform/tools/base/+/studio-1.2-dev/lint/cli/src/test/java/com/android/tools/lint/checks/ApiDetectorTest.java"},"comment":{"url":"https://api.github.com/repos/JakeWharton/timber/issues/comments/94433561","html_url":"https://github.com/JakeWharton/timber/issues/45#issuecomment-94433561","issue_url":"https://api.github.com/repos/JakeWharton/timber/issues/45","id":94433561,"user":{"login":"a11n","id":10038423,"avatar_url":"https://avatars.githubusercontent.com/u/10038423?v=3","gravatar_id":"","url":"https://api.github.com/users/a11n","html_url":"https://github.com/a11n","followers_url":"https://api.github.com/users/a11n/followers","following_url":"https://api.github.com/users/a11n/following{/other_user}","gists_url":"https://api.github.com/users/a11n/gists{/gist_id}","starred_url":"https://api.github.com/users/a11n/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/a11n/subscriptions","organizations_url":"https://api.github.com/users/a11n/orgs","repos_url":"https://api.github.com/users/a11n/repos","events_url":"https://api.github.com/users/a11n/events{/privacy}","received_events_url":"https://api.github.com/users/a11n/received_events","type":"User","site_admin":false},"created_at":"2015-04-20T11:59:53Z","updated_at":"2015-04-20T11:59:53Z","body":"I spent a lot time on researching what is a convenient way to test custom Lint rules. I didn't like the `AbstractCheckTest`since it has too many \"non-public\" dependencies on the hand and it assertion is very poor on the other hand.\r\n\r\nI finally created a JUnit rule for that. It basically uses the same approach than Android does internally - but it allows more advanced assertions and is very straight forward to use.\r\n\r\nMaybe it is also interesting for your use case.\r\nhttps://github.com/a11n/lint-junit-rule\r\n\r\n```java\r\n@Rule public Lint lint = new Lint();\r\n\r\n  @Test\r\n  public void test() throws Exception {\r\n    lint.setFiles(\"AndroidManifest.xml\", \"res/values/string.xml\");\r\n    lint.setIssues(MyCustomRule.ISSUE);\r\n\r\n    lint.analyze();\r\n\r\n    List<Warning> warnings = lint.getWarnings();\r\n\r\n    assertThat(warnings).hasSize(2);\r\n  }\r\n```\r\n\r\nHere is an example with more detailed assertions:\r\nhttps://github.com/a11n/AndroidLintPlaceholderCheck/blob/master/src/test/java/de/ad/android/tools/lint/HardcodedValuesDetectorTest.java\r\n"}}