@Test @SuppressWarnings("unchecked") public void testGetMaxSeverity() { when(violation1.getViolationType()).thenReturn(Violation.Type.INFO); when(violation2.getViolationType()).thenReturn(Violation.Type.WARNING); when(violation3.getViolationType()).thenReturn(Violation.Type.ERROR); assertEquals(Violation.Type.ERROR, ValidationUtils.getMaxSeverity(violations)); when(violation3.getViolationType()).thenReturn(Violation.Type.INFO); assertEquals(Violation.Type.WARNING, ValidationUtils.getMaxSeverity(violations)); when(violation1.getViolationType()).thenReturn(Violation.Type.ERROR); assertEquals(Violation.Type.ERROR, ValidationUtils.getMaxSeverity(violations)); }
public static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations) { final Violation.Type[] type = {Violation.Type.INFO}; violations.forEach(v -> { if (v.getViolationType().getSeverity() > type[0].getSeverity()) { type[0] = v.getViolationType(); } }); return type[0]; }
ValidationUtils { public static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations) { final Violation.Type[] type = {Violation.Type.INFO}; violations.forEach(v -> { if (v.getViolationType().getSeverity() > type[0].getSeverity()) { type[0] = v.getViolationType(); } }); return type[0]; } }
ValidationUtils { public static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations) { final Violation.Type[] type = {Violation.Type.INFO}; violations.forEach(v -> { if (v.getViolationType().getSeverity() > type[0].getSeverity()) { type[0] = v.getViolationType(); } }); return type[0]; }  }
ValidationUtils { public static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations) { final Violation.Type[] type = {Violation.Type.INFO}; violations.forEach(v -> { if (v.getViolationType().getSeverity() > type[0].getSeverity()) { type[0] = v.getViolationType(); } }); return type[0]; }  static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations); }
ValidationUtils { public static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations) { final Violation.Type[] type = {Violation.Type.INFO}; violations.forEach(v -> { if (v.getViolationType().getSeverity() > type[0].getSeverity()) { type[0] = v.getViolationType(); } }); return type[0]; }  static Violation.Type getMaxSeverity(final Collection<? extends Violation> violations);  }