Class ConditionEvents

java.lang.Object
com.tngtech.archunit.lang.ConditionEvents
All Implemented Interfaces:
java.lang.Iterable<ConditionEvent>

public final class ConditionEvents
extends java.lang.Object
implements java.lang.Iterable<ConditionEvent>
  • Constructor Details

  • Method Details

    • add

      @PublicAPI(usage=ACCESS) public void add​(ConditionEvent event)
    • setInformationAboutNumberOfViolations

      @PublicAPI(usage=ACCESS) public void setInformationAboutNumberOfViolations​(java.lang.String informationAboutNumberOfViolations)
      Can be used to override the information about the number of violations. If absent the violated rule will simply report the number of violation lines as the number of violations (which is typically correct, since ArchUnit usually reports one violation per line). However in cases where violations are omitted (e.g. because a limit of reported violations is configured), this information can be supplied here to inform users there there actually were more violations than reported.
      Parameters:
      informationAboutNumberOfViolations - The text to be shown for the number of times a rule has been violated
    • getViolating

      @PublicAPI(usage=ACCESS) public java.util.Collection<ConditionEvent> getViolating()
    • getAllowed

      @PublicAPI(usage=ACCESS) public java.util.Collection<ConditionEvent> getAllowed()
    • containViolation

      @PublicAPI(usage=ACCESS) public boolean containViolation()
    • isEmpty

      @PublicAPI(usage=ACCESS) public boolean isEmpty()
    • getFailureDescriptionLines

      @Deprecated @PublicAPI(usage=ACCESS) public java.util.List<java.lang.String> getFailureDescriptionLines()
      Deprecated.
      Returns:
      List of text lines describing the contained failures of these events.
    • getFailureMessages

      @PublicAPI(usage=ACCESS) public FailureMessages getFailureMessages()
      Returns:
      Sorted failure messages describing the contained failures of these events. Also offers information about the number of violations contained in these events.
    • handleViolations

      @PublicAPI(usage=ACCESS, state=EXPERIMENTAL) public void handleViolations​(ViolationHandler<?> violationHandler)
      Passes violations to the supplied ViolationHandler. The passed violations will automatically be filtered by the reified type of the given ViolationHandler. That is, if a ViolationHandler<SomeClass> is passed, only violations by objects assignable to SomeClass will be reported. The term 'reified' means that the type parameter was not erased, i.e. ArchUnit can still determine the actual type parameter of the passed violation handler, otherwise the upper bound, in extreme cases Object, will be used (i.e. all violations will be passed).
      Parameters:
      violationHandler - The violation handler that is supposed to handle all violations matching the respective type parameter
    • iterator

      @PublicAPI(usage=ACCESS) public java.util.Iterator<ConditionEvent> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<ConditionEvent>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object