Class LogAssert

java.lang.Object
org.assertj.core.api.AbstractAssert<LogAssert,LogClass>
com.soebes.itf.extension.assertj.LogAssert
All Implemented Interfaces:
org.assertj.core.api.Assert<LogAssert,LogClass>, org.assertj.core.api.Descriptable<LogAssert>, org.assertj.core.api.ExtensionPoints<LogAssert,LogClass>

@API(status=EXPERIMENTAL, since="0.8.0") public class LogAssert extends org.assertj.core.api.AbstractAssert<LogAssert,LogClass>
Assertions related to logging output of Maven.
Author:
Karl Heinz Marbaise
See Also:
  • Field Summary

    Fields inherited from class org.assertj.core.api.AbstractAssert

    actual, info, myself, objects, throwUnsupportedExceptionOnEquals
  • Constructor Summary

    Constructors
    Constructor
    Description
    Create an instance of LogAssert.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.assertj.core.api.ListAssert<String>
    Will give you back the stdout and removes the prefix "[DEBUG] " from all lines.
    org.assertj.core.api.ListAssert<String>
    Will read the stdout and removes the prefix "[ERROR] ".
    int
    Always returns 1.
    org.assertj.core.api.ListAssert<String>
    Will give you back the stdout and removes the prefix "[INFO] " (including the single space) from all lines.
    org.assertj.core.api.ListAssert<String>
    Will read the stdout without any filtering etc.
    org.assertj.core.api.ListAssert<String>
    Will read the stdout and removes the prefix "[WARNING] ".

    Methods inherited from class org.assertj.core.api.AbstractAssert

    areEqual, asInstanceOf, asList, assertionError, asString, describedAs, descriptionText, doesNotHave, doesNotHaveSameClassAs, doesNotHaveSameHashCodeAs, doesNotHaveToString, equals, extracting, extracting, failure, failureWithActualExpected, failWithActualExpectedAndMessage, failWithMessage, getWritableAssertionInfo, has, hasSameClassAs, hasSameHashCodeAs, hasToString, inBinary, inHexadecimal, is, isElementOfCustomAssert, isEqualTo, isExactlyInstanceOf, isIn, isIn, isInstanceOf, isInstanceOfAny, isInstanceOfSatisfying, isNot, isNotEqualTo, isNotExactlyInstanceOf, isNotIn, isNotIn, isNotInstanceOf, isNotInstanceOfAny, isNotNull, isNotOfAnyClassIn, isNotSameAs, isNull, isOfAnyClassIn, isSameAs, matches, matches, newListAssertInstance, overridingErrorMessage, overridingErrorMessage, satisfies, satisfies, satisfies, satisfiesAnyOf, satisfiesAnyOf, satisfiesAnyOfForProxy, satisfiesForProxy, setCustomRepresentation, setDescriptionConsumer, setPrintAssertionsDescription, throwAssertionError, usingComparator, usingComparator, usingDefaultComparator, usingRecursiveAssertion, usingRecursiveAssertion, usingRecursiveComparison, usingRecursiveComparison, withFailMessage, withFailMessage, withRepresentation, withThreadDumpOnError

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.assertj.core.api.Descriptable

    as, as, as, describedAs
  • Constructor Details

    • LogAssert

      LogAssert(LogClass actual)
      Create an instance of LogAssert.
      Parameters:
      actual - LogClass
  • Method Details

    • info

      public org.assertj.core.api.ListAssert<String> info()
      Will give you back the stdout and removes the prefix "[INFO] " (including the single space) from all lines.

      It can be used to check for a sequence in the log output like this:

      
         assertThat(result)
          .out()
          .info()
          .containsSequence("The first line matching.", "The second line matching");
       
      Returns:
      ListAssert
      Since:
      0.8.0
      See Also:
      • AbstractIterableAssert.containsSequence(Object[])
    • debug

      public org.assertj.core.api.ListAssert<String> debug()
      Will give you back the stdout and removes the prefix "[DEBUG] " from all lines. This could be used like the following:
      
         assertThat(result)
          .out()
          .debug()
          .contains("Text to be checked for.");
       
      The debug() will give you back all entries which have the prefix [DEBUG] . The debug() can be combined with other parts of AssertJ like:
      
         assertThat(result)
          .out()
          .debug()
          .hasSize(1) // Only a single DEBUG line is allowed.
          .contains("This is something.");
       
      The above example will obviously fail cause there always more than one line of debug output being produced during a Maven build.
      Returns:
      ListAssert
      See Also:
    • warn

      public org.assertj.core.api.ListAssert<String> warn()
      Will read the stdout and removes the prefix "[WARNING] ". This could be used like the following:
      
         assertThat(result)
          .out()
          .warn()
          .containsExactly("Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!");
       
      The warn() will give you back all entries which have the prefix [WARNING] . The warn() can be combined with other parts of AssertJ like:
      
         assertThat(result)
          .log()
          .warn()
          .hasSize(1) // Only a single WARNING is allowed.
          .contains("Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!");
       
      Returns:
      ListAssert
      See Also:
    • error

      public org.assertj.core.api.ListAssert<String> error()
      Will read the stdout and removes the prefix "[ERROR] ". This could be used like the following:
      
         assertThat(result)
          .out()
          .error()
          .containsExactly("exception.");
       
      The error() will give you back all entries which have the prefix [ERROR] .
      Returns:
      ListAssert
      See Also:
    • plain

      public org.assertj.core.api.ListAssert<String> plain()
      Will read the stdout without any filtering etc.
      
         assertThat(result)
          .out()
          .plain()
          .contains("[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!");
       
      Returns:
      ListAssert
      See Also:
    • hashCode

      public int hashCode()
      Always returns 1.
      Overrides:
      hashCode in class org.assertj.core.api.AbstractAssert<LogAssert,LogClass>
      Returns:
      1.