private String comparingString(final Violation o) { return o.file + "_" + (Integer.MAX_VALUE - o.getStartLine()) + "_" + o.getParser() + "_" + o.getMessage(); } }
private String comparingString(final Violation o) { return o.file + "_" + (Integer.MAX_VALUE - o.getStartLine()) + "_" + o.getParser() + "_" + o.getMessage(); } }
@Test public void testThatViolationsCanBeParsed() { final String rootFolder = getRootFolder(); final List<Violation> actual = violationsApi() // .withPattern(".*/kotlingradle/.*\\.txt") // .inFolder(rootFolder) // .findAll(KOTLINGRADLE) // .violations(); assertThat(actual) // .hasSize(3); final Violation violation0 = actual.get(0); assertThat(violation0.getMessage()) // .isEqualTo( "Elvis operator (?:) always returns the left operand of non-nullable type String"); assertThat(violation0.getFile()) // .isEqualTo("/Users/scottkennedy/project/src/main/java/com/example/Test.kt"); assertThat(violation0.getSeverity()) // .isEqualTo(WARN); assertThat(violation0.getRule()) // .isEqualTo(""); assertThat(violation0.getParser()) // .isEqualTo(KOTLINGRADLE); } }
@Test public void testThatViolationsCanBeParsed() { final String rootFolder = getRootFolder(); final List<Violation> actual = violationsApi() // .withPattern(".*/kotlinmaven/.*\\.txt") // .inFolder(rootFolder) // .findAll(KOTLINMAVEN) // .violations(); assertThat(actual) // .hasSize(29); final Violation violation0 = actual.get(0); assertThat(violation0.getMessage()) // .isEqualTo("Unchecked cast: AssetDao<*> to DaoOperations.Read<T, UUID>"); assertThat(violation0.getFile()) // .isEqualTo( "/home/bjerre/workspace/kerub/src/main/kotlin/com/github/kerubistan/kerub/data/hub/AnyAssetDaoImpl.kt"); assertThat(violation0.getSeverity()) // .isEqualTo(WARN); assertThat(violation0.getRule()) // .isEqualTo(""); assertThat(violation0.getParser()) // .isEqualTo(KOTLINMAVEN); } }