Package com.google.android.exoplayer2.testutil.truth

## Class SpannedSubject

- java.lang.Object
- - com.google.common.truth.Subject
  - - com.google.android.exoplayer2.testutil.truth.SpannedSubject

-     public final class SpannedSubject
      extends com.google.common.truth.Subject

  A Truth `Subject` for assertions on `Spanned` instances containing text styling.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static interface` | `SpannedSubject.AbsoluteSized` | Allows assertions about the absolute size of a span.
    `static interface` | `SpannedSubject.Aligned` | Allows assertions about the alignment of a span.
    `static interface` | `SpannedSubject.AndSpanFlags` | Allows additional assertions to be made on the flags of matching spans.
    `static interface` | `SpannedSubject.Colored` | Allows assertions about the color of a span.
    `static interface` | `SpannedSubject.EmphasizedText` | Allows assertions about a span's text emphasis mark and its position.
    `static interface` | `SpannedSubject.RelativeSized` | Allows assertions about the relative size of a span.
    `static interface` | `SpannedSubject.RubyText` | Allows assertions about a span's ruby text and its position.
    `static interface` | `SpannedSubject.Typefaced` | Allows assertions about the typeface of a span.
    `static interface` | `SpannedSubject.WithSpanFlags` | Allows additional assertions to be made on the flags of matching spans.

    - ### Nested classes/interfaces inherited from class com.google.common.truth.Subject

      `com.google.common.truth.Subject.Factory<SubjectT extends com.google.common.truth.Subject,​ActualT extends Object>`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static SpannedSubject` | `assertThat​(Spanned spanned)` | Convenience method to create a SpannedSubject.
    `SpannedSubject.AbsoluteSized` | `hasAbsoluteSizeSpanBetween​(int start, int end)` | Checks that the subject has a `AbsoluteSizeSpan` from `start` to `end`.
    `SpannedSubject.Aligned` | `hasAlignmentSpanBetween​(int start, int end)` | Checks that the subject has a `AlignmentSpan` from `start` to `end`.
    `SpannedSubject.Colored` | `hasBackgroundColorSpanBetween​(int start, int end)` | Checks that the subject has a `BackgroundColorSpan` from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasBoldItalicSpanBetween​(int start, int end)` | Checks that the subject has bold and italic styling from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasBoldSpanBetween​(int start, int end)` | Checks that the subject has a bold span from `start` to `end`.
    `SpannedSubject.Colored` | `hasForegroundColorSpanBetween​(int start, int end)` | Checks that the subject has a `ForegroundColorSpan` from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasHorizontalTextInVerticalContextSpanBetween​(int start, int end)` | Checks that the subject has an `HorizontalTextInVerticalContextSpan` from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasItalicSpanBetween​(int start, int end)` | Checks that the subject has an italic span from `start` to `end`.
    `void` | `hasNoAbsoluteSizeSpanBetween​(int start, int end)` | Checks that the subject has no `AbsoluteSizeSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoAlignmentSpanBetween​(int start, int end)` | Checks that the subject has no `AlignmentSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoBackgroundColorSpanBetween​(int start, int end)` | Checks that the subject has no `BackgroundColorSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoForegroundColorSpanBetween​(int start, int end)` | Checks that the subject has no `ForegroundColorSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoHorizontalTextInVerticalContextSpanBetween​(int start, int end)` | Checks that the subject has no `HorizontalTextInVerticalContextSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoRelativeSizeSpanBetween​(int start, int end)` | Checks that the subject has no `RelativeSizeSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoRubySpanBetween​(int start, int end)` | Checks that the subject has no `RubySpan`s on any of the text between `start` and `end`.
    `void` | `hasNoSpans()` |
    `void` | `hasNoStrikethroughSpanBetween​(int start, int end)` | Checks that the subject has no `StrikethroughSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoStyleSpanBetween​(int start, int end)` | Checks that the subject has no `StyleSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoTextEmphasisSpanBetween​(int start, int end)` | Checks that the subject has no `TextEmphasisSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoTypefaceSpanBetween​(int start, int end)` | Checks that the subject has no `TypefaceSpan`s on any of the text between `start` and `end`.
    `void` | `hasNoUnderlineSpanBetween​(int start, int end)` | Checks that the subject has no `UnderlineSpan`s on any of the text between `start` and `end`.
    `SpannedSubject.RelativeSized` | `hasRelativeSizeSpanBetween​(int start, int end)` | Checks that the subject has a `RelativeSizeSpan` from `start` to `end`.
    `SpannedSubject.RubyText` | `hasRubySpanBetween​(int start, int end)` | Checks that the subject has a `RubySpan` from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasStrikethroughSpanBetween​(int start, int end)` | Checks that the subject has an `StrikethroughSpan` from `start` to `end`.
    `SpannedSubject.EmphasizedText` | `hasTextEmphasisSpanBetween​(int start, int end)` | Checks that the subject has an `TextEmphasisSpan` from `start` to `end`.
    `SpannedSubject.Typefaced` | `hasTypefaceSpanBetween​(int start, int end)` | Checks that the subject has a `TypefaceSpan` from `start` to `end`.
    `SpannedSubject.WithSpanFlags` | `hasUnderlineSpanBetween​(int start, int end)` | Checks that the subject has an `UnderlineSpan` from `start` to `end`.
    `static com.google.common.truth.Subject.Factory<SpannedSubject,​Spanned>` | `spanned()` |

    - ### Methods inherited from class com.google.common.truth.Subject

      `actualCustomStringRepresentation, check, equals, failWithActual, failWithActual, failWithoutActual, hashCode, ignoreCheck, isAnyOf, isEqualTo, isIn, isInstanceOf, isNoneOf, isNotEqualTo, isNotIn, isNotInstanceOf, isNotNull, isNotSameInstanceAs, isNull, isSameInstanceAs, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### spanned

          public static com.google.common.truth.Subject.Factory<SpannedSubject,​Spanned> spanned()

    - #### assertThat

          public static SpannedSubject assertThat​(@Nullable
                                                  Spanned spanned)

      Convenience method to create a SpannedSubject.

      Can be statically imported alongside other Truth `assertThat` methods.

      Parameters:
        `spanned` - The subject under test.
      Returns:
        An object for conducting assertions on the subject.

    - #### hasNoSpans

          public void hasNoSpans()

    - #### hasItalicSpanBetween

          public SpannedSubject.WithSpanFlags hasItalicSpanBetween​(int start,
                                                                   int end)

      Checks that the subject has an italic span from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasBoldSpanBetween

          public SpannedSubject.WithSpanFlags hasBoldSpanBetween​(int start,
                                                                 int end)

      Checks that the subject has a bold span from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasBoldItalicSpanBetween

          public SpannedSubject.WithSpanFlags hasBoldItalicSpanBetween​(int start,
                                                                       int end)

      Checks that the subject has bold and italic styling from `start` to `end`.

      This can either be:

      - A single `StyleSpan` with `span.getStyle() == Typeface.BOLD_ITALIC`.
      - Two `StyleSpan`s, one with `span.getStyle() == Typeface.BOLD` and the other with `span.getStyle() == Typeface.ITALIC`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasNoStyleSpanBetween

          public void hasNoStyleSpanBetween​(int start,
                                            int end)

      Checks that the subject has no `StyleSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasUnderlineSpanBetween

          public SpannedSubject.WithSpanFlags hasUnderlineSpanBetween​(int start,
                                                                      int end)

      Checks that the subject has an `UnderlineSpan` from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasNoUnderlineSpanBetween

          public void hasNoUnderlineSpanBetween​(int start,
                                                int end)

      Checks that the subject has no `UnderlineSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasStrikethroughSpanBetween

          public SpannedSubject.WithSpanFlags hasStrikethroughSpanBetween​(int start,
                                                                          int end)

      Checks that the subject has an `StrikethroughSpan` from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasNoStrikethroughSpanBetween

          public void hasNoStrikethroughSpanBetween​(int start,
                                                    int end)

      Checks that the subject has no `StrikethroughSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasAlignmentSpanBetween

          @CheckResult
          public SpannedSubject.Aligned hasAlignmentSpanBetween​(int start,
                                                                int end)

      Checks that the subject has a `AlignmentSpan` from `start` to `end`.

      The alignment is asserted in a follow-up method call on the return `SpannedSubject.Aligned` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.Aligned` object to assert on the alignment of the matching spans.

    - #### hasNoAlignmentSpanBetween

          public void hasNoAlignmentSpanBetween​(int start,
                                                int end)

      Checks that the subject has no `AlignmentSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasForegroundColorSpanBetween

          @CheckResult
          public SpannedSubject.Colored hasForegroundColorSpanBetween​(int start,
                                                                      int end)

      Checks that the subject has a `ForegroundColorSpan` from `start` to `end`.

      The color is asserted in a follow-up method call on the return `SpannedSubject.Colored` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.Colored` object to assert on the color of the matching spans.

    - #### hasNoForegroundColorSpanBetween

          public void hasNoForegroundColorSpanBetween​(int start,
                                                      int end)

      Checks that the subject has no `ForegroundColorSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasBackgroundColorSpanBetween

          @CheckResult
          public SpannedSubject.Colored hasBackgroundColorSpanBetween​(int start,
                                                                      int end)

      Checks that the subject has a `BackgroundColorSpan` from `start` to `end`.

      The color is asserted in a follow-up method call on the return `SpannedSubject.Colored` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.Colored` object to assert on the color of the matching spans.

    - #### hasNoBackgroundColorSpanBetween

          public void hasNoBackgroundColorSpanBetween​(int start,
                                                      int end)

      Checks that the subject has no `BackgroundColorSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasTypefaceSpanBetween

          @CheckResult
          public SpannedSubject.Typefaced hasTypefaceSpanBetween​(int start,
                                                                 int end)

      Checks that the subject has a `TypefaceSpan` from `start` to `end`.

      The font is asserted in a follow-up method call on the return `SpannedSubject.Typefaced` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.Typefaced` object to assert on the font of the matching spans.

    - #### hasNoTypefaceSpanBetween

          public void hasNoTypefaceSpanBetween​(int start,
                                               int end)

      Checks that the subject has no `TypefaceSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasAbsoluteSizeSpanBetween

          @CheckResult
          public SpannedSubject.AbsoluteSized hasAbsoluteSizeSpanBetween​(int start,
                                                                         int end)

      Checks that the subject has a `AbsoluteSizeSpan` from `start` to `end`.

      The size is asserted in a follow-up method call on the return `SpannedSubject.AbsoluteSized` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.AbsoluteSized` object to assert on the size of the matching spans.

    - #### hasNoAbsoluteSizeSpanBetween

          public void hasNoAbsoluteSizeSpanBetween​(int start,
                                                   int end)

      Checks that the subject has no `AbsoluteSizeSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasRelativeSizeSpanBetween

          @CheckResult
          public SpannedSubject.RelativeSized hasRelativeSizeSpanBetween​(int start,
                                                                         int end)

      Checks that the subject has a `RelativeSizeSpan` from `start` to `end`.

      The size is asserted in a follow-up method call on the return `SpannedSubject.RelativeSized` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.RelativeSized` object to assert on the size of the matching spans.

    - #### hasNoRelativeSizeSpanBetween

          public void hasNoRelativeSizeSpanBetween​(int start,
                                                   int end)

      Checks that the subject has no `RelativeSizeSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasRubySpanBetween

          @CheckResult
          public SpannedSubject.RubyText hasRubySpanBetween​(int start,
                                                            int end)

      Checks that the subject has a `RubySpan` from `start` to `end`.

      The ruby-text is asserted in a follow-up method call on the return `SpannedSubject.RubyText` object.

      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.Colored` object to assert on the color of the matching spans.

    - #### hasNoRubySpanBetween

          public void hasNoRubySpanBetween​(int start,
                                           int end)

      Checks that the subject has no `RubySpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasHorizontalTextInVerticalContextSpanBetween

          public SpannedSubject.WithSpanFlags hasHorizontalTextInVerticalContextSpanBetween​(int start,
                                                                                            int end)

      Checks that the subject has an `HorizontalTextInVerticalContextSpan` from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.WithSpanFlags` object for optional additional assertions on the flags.

    - #### hasTextEmphasisSpanBetween

          public SpannedSubject.EmphasizedText hasTextEmphasisSpanBetween​(int start,
                                                                          int end)

      Checks that the subject has an `TextEmphasisSpan` from `start` to `end`.
      Parameters:
        `start` - The start of the expected span.
        `end` - The end of the expected span.
      Returns:
        A `SpannedSubject.EmphasizedText` object for optional additional assertions on the flags.

    - #### hasNoTextEmphasisSpanBetween

          public void hasNoTextEmphasisSpanBetween​(int start,
                                                   int end)

      Checks that the subject has no `TextEmphasisSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.

    - #### hasNoHorizontalTextInVerticalContextSpanBetween

          public void hasNoHorizontalTextInVerticalContextSpanBetween​(int start,
                                                                      int end)

      Checks that the subject has no `HorizontalTextInVerticalContextSpan`s on any of the text between `start` and `end`.

      This fails even if the start and end indexes don't exactly match.

      Parameters:
        `start` - The start index to start searching for spans.
        `end` - The end index to stop searching for spans.