Module org.testfx

Class AbstractTextFlowAssert<SELF extends AbstractTextFlowAssert<SELF>>

  • All Implemented Interfaces:
    org.assertj.core.api.Assert<SELF,​javafx.css.Styleable>, org.assertj.core.api.Descriptable<SELF>, org.assertj.core.api.ExtensionPoints<SELF,​javafx.css.Styleable>
    Direct Known Subclasses:
    TextFlowAssert

    public class AbstractTextFlowAssert<SELF extends AbstractTextFlowAssert<SELF>>
    extends AbstractParentAssert<SELF>
    Base class for all TextFlow assertions.
    • Constructor Detail

      • AbstractTextFlowAssert

        protected AbstractTextFlowAssert​(javafx.scene.text.TextFlow actual,
                                         Class<?> selfType)
    • Method Detail

      • hasText

        public SELF hasText​(String text)
        Verifies that the actual TextFlow has exactly the given text (the result of combining all of its text-based children's text together).
        Parameters:
        text - the given text to compare the actual text to
        Returns:
        this assertion object
      • doesNotHaveText

        public SELF doesNotHaveText​(String text)
        Verifies that the actual TextFlow does not have exactly the given text (the result of combining all of its text-based children's text together).
        Parameters:
        text - the given text to compare the actual text to
        Returns:
        this assertion object
      • hasColoredText

        public SELF hasColoredText​(String coloredTextMarkup)
        Verifies that the actual TextFlow has the given coloredTextMarkup. The color is matched by using the closest named color, as described below.

        Colors are specified using the following markup:

        <COLOR>text</COLOR>

        Where COLOR is one of JavaFX's named colors.

        Here is an example for verifying that a TextFlow contains the text "hello" and that the named color that has the closest value to the color of the text is Colors.RED:

        
           Text text = new Text("hello");
           text.setFill(Colors.RED);
           TextFlow textFlow = new TextFlow(text);
           assertThat(textFlow).hasColoredText("<RED>hello</RED>");
         
        Parameters:
        coloredTextMarkup - the given colored text markup to compare the actual colored text to
        Returns:
        this assertion object
        See Also:
        Named Colors
      • doesNotHaveColoredText

        public SELF doesNotHaveColoredText​(String coloredTextMarkup)
        Verifies that the actual TextFlow does not have the given coloredTextMarkup. The color is matched by using the closest named color, as described below.

        Colors are specified using the following markup:

        <COLOR>text</COLOR>

        Where COLOR is one of JavaFX's named colors.

        Here is an example for verifying that a TextFlow does not contain the text "hello" with any color that has the closest named color Colors.RED:

        
           Text text = new Text("hello");
           text.setFill(Colors.BLUE);
           TextFlow textFlow = new TextFlow(text);
           assertThat(textFlow).doesNotHaveColoredText("<RED>hello</RED>");
         
        Parameters:
        coloredTextMarkup - the given colored text markup to compare the actual colored text to
        Returns:
        this assertion object
        See Also:
        Named Colors
      • hasExactlyColoredText

        public SELF hasExactlyColoredText​(String coloredTextMarkup)
        Verifies that the actual TextFlow has exactly the given coloredTextMarkup. The color is matched in an exact way, as described below.

        Colors are specified using the following markup:

        <COLOR>text</COLOR>

        Where COLOR is one of JavaFX's named colors.

        Here is an example for verifying that a TextFlow contains the text "hello" and that the color of the text is exactly Colors.BLUE (that is, it has an RGB value of (0, 0, 255)).

        
           Text text = new Text("hello");
           text.setFill(Colors.BLUE); // or: text.setFill(Colors.rgb(0, 0, 255));
           TextFlow textFlow = new TextFlow(text);
           assertThat(textFlow).hasExactlyColoredText("hello");
         
        Parameters:
        coloredTextMarkup - the given colored text markup to compare the actual colored text to
        Returns:
        this assertion object
        See Also:
        Named Colors
      • doesNotHaveExactlyColoredText

        public SELF doesNotHaveExactlyColoredText​(String coloredTextMarkup)
        Verifies that the actual TextFlow does not have exactly the given coloredTextMarkup. The color is matched in an exact way, as described below.

        Colors are specified using the following markup:

        <COLOR>text</COLOR>

        Where COLOR is one of JavaFX's named colors.

        Here is an example for verifying that a TextFlow does not contain the text "hello" and that the color of the text is not exactly Colors.BLUE (that is, it does not have an RGB value of (0, 0, 255)).

        
           Text text = new Text("hello");
           text.setFill(Colors.rgb(0, 0, 254));
           TextFlow textFlow = new TextFlow(text);
           assertThat(textFlow).doesNotHaveExactlyColoredText("hello");
         
        Parameters:
        coloredTextMarkup - the given colored text markup to compare the actual colored text to
        Returns:
        this assertion object
        See Also:
        Named Colors