Interface CDateState

  • All Superinterfaces:
    CBaseState<java.util.Date>, CObjectState<java.util.Date>
    All Known Subinterfaces:
    CDateExtension
    All Known Implementing Classes:
    CDate

    public interface CDateState
    extends CObjectState<java.util.Date>

    CDateState is an interface for Date state related methods.

    We need this interface to have possibility of adding state to any exists objects with the minimum change in the code.

    • Method Summary

      All Methods Instance Methods Default Methods 
      Modifier and Type Method Description
      default boolean equals​(java.util.Date expected)
      Check if actual and expected have the exact same date value (compare to milliseconds) or they both has null value
      default boolean equalsByFormat​(java.util.Date expected, java.lang.String format)
      Check if actual and expected have the exact same string value after they converted using the provided date format.
      default boolean equalsDatePortion​(java.util.Date expected)
      Check if actual and expected have same string value after they converted using "yyyy-MM-dd" for format.
      default boolean equalsTimePortion​(java.util.Date expected)
      Check if actual and expected have same string value after they converted using "HH:mm:ss" for format.
      default boolean notEquals​(java.util.Date expected)
      Check if actual and expected does not have the exact same date value (compare to milliseconds) or one of them is null
      default boolean notEqualsByFormat​(java.util.Date expected, java.lang.String format)
      Check if actual and expected have different string value after they converted using the provided date format.
      default boolean notEqualsDatePortion​(java.util.Date expected)
      Check if actual and expected have different string value after they converted using "yyyy-MM-dd" for format.
      default boolean notEqualsTimePortion​(java.util.Date expected)
      Check if actual and expected have different string value after they converted using "HH:mm:ss" for format.
      • Methods inherited from interface org.catools.common.extensions.states.interfaces.CBaseState

        getValue
      • Methods inherited from interface org.catools.common.extensions.states.interfaces.CObjectState

        is
    • Method Detail

      • equals

        default boolean equals​(java.util.Date expected)
        Check if actual and expected have the exact same date value (compare to milliseconds) or they both has null value

        Please note that verification consider as passe if both value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • equalsByFormat

        default boolean equalsByFormat​(java.util.Date expected,
                                       java.lang.String format)
        Check if actual and expected have the exact same string value after they converted using the provided date format. Means that verification of "2019-08-09 12:20" and "2019-08-09 11:20" using "yyyy-MM-dd" passes.

        Please note that verification consider as passe if both value is null

        Parameters:
        expected - value to compare
        format - date format to be use
        Returns:
        execution boolean result
      • equalsDatePortion

        default boolean equalsDatePortion​(java.util.Date expected)
        Check if actual and expected have same string value after they converted using "yyyy-MM-dd" for format. Means that verification of "2019-08-09 12:20" and "2019-08-09 11:20" passes

        Please note that verification consider as passe if both value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • equalsTimePortion

        default boolean equalsTimePortion​(java.util.Date expected)
        Check if actual and expected have same string value after they converted using "HH:mm:ss" for format. Means that verification of "2019-08-09 12:20" and "2019-08-08 12:20" passes

        Please note that verification consider as passe if both value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • notEquals

        default boolean notEquals​(java.util.Date expected)
        Check if actual and expected does not have the exact same date value (compare to milliseconds) or one of them is null

        Please note that verification consider as passe if expected value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • notEqualsByFormat

        default boolean notEqualsByFormat​(java.util.Date expected,
                                          java.lang.String format)
        Check if actual and expected have different string value after they converted using the provided date format. Means that verification of "2019-08-09 12:20" and "2019-08-09 11:20" using "yyyy-MM-dd HH" passes (means values are different)

        Please note that verification consider as passe if expected value is null

        Parameters:
        expected - value to compare
        format - date format to be use
        Returns:
        execution boolean result
      • notEqualsDatePortion

        default boolean notEqualsDatePortion​(java.util.Date expected)
        Check if actual and expected have different string value after they converted using "yyyy-MM-dd" for format. Means that verification of "2019-08-09 12:20" and "2019-08-08 12:20" passes (means values are different)

        Please note that verification consider as passe if expected value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result
      • notEqualsTimePortion

        default boolean notEqualsTimePortion​(java.util.Date expected)
        Check if actual and expected have different string value after they converted using "HH:mm:ss" for format. Means that verification of "2019-08-09 12:20:31" and "2019-08-09 12:20:30" passes (means values are different)

        Please note that verification consider as passe if expected value is null

        Parameters:
        expected - value to compare
        Returns:
        execution boolean result