Skip to content

Commit

Permalink
Add rule to use Matcher.is(true|false) with error message
Browse files Browse the repository at this point in the history
  • Loading branch information
pnatashap committed Dec 23, 2023
1 parent eeed135 commit 32467b6
Show file tree
Hide file tree
Showing 15 changed files with 68 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ public class AutoCompleteAssert extends UIAssert<AutoCompleteAssert, AutoComplet

@JDIAction("Assert that '{name}' is expanded")
public AutoCompleteAssert expanded() {
jdiAssert(element().expanded(), Matchers.is(true));
jdiAssert(element().expanded(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' is collapsed")
public AutoCompleteAssert collapsed() {
jdiAssert(element().collapsed(), Matchers.is(true));
jdiAssert(element().collapsed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand All @@ -48,13 +48,13 @@ public AutoCompleteAssert placeholder(String expected) {

@JDIAction("Assert that '{name} is mandatory")
public AutoCompleteAssert mandatory() {
jdiAssert(element().isMandatory(), Matchers.is(true));
jdiAssert(element().isMandatory(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name} is not mandatory")
public AutoCompleteAssert notMandatory() {
jdiAssert(element().isMandatory(), Matchers.is(false));
jdiAssert(element().isMandatory(), Matchers.is(false), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand All @@ -67,13 +67,13 @@ public AutoCompleteAssert empty() {

@JDIAction("Assert that '{name} is invalid")
public AutoCompleteAssert invalid() {
jdiAssert(element().isInvalidated(), Matchers.is(true));
jdiAssert(element().isInvalidated(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name} is valid")
public AutoCompleteAssert valid() {
jdiAssert(element().isInvalidated(), Matchers.is(false));
jdiAssert(element().isInvalidated(), Matchers.is(false), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down Expand Up @@ -103,13 +103,13 @@ public AutoCompleteAssert groupsAndOptions(Map<String, List<String>> expectedGro

@JDIAction("Assert that '{name}' has the {0} option being highlighted")
public AutoCompleteAssert optionHighlighted(String option) {
jdiAssert(element().isOptionHighlighted(option), Matchers.is(true));
jdiAssert(element().isOptionHighlighted(option), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has the {0} option being not highlighted")
public AutoCompleteAssert optionNotHighlighted(String option) {
jdiAssert(element().isOptionHighlighted(option), Matchers.is(false));
jdiAssert(element().isOptionHighlighted(option), Matchers.is(false), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ public BottomSheetAssert values(final List<String> values) {
}

public BottomSheetAssert opened() {
jdiAssert(element().isOpened(), Matchers.is(true));
jdiAssert(element().isOpened(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

public BottomSheetAssert closed() {
jdiAssert(element().isClosed(), Matchers.is(true));
jdiAssert(element().isClosed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
public class CardAssert extends UIAssert<CardAssert, Card> {
@JDIAction("Assert that '{name}' has text '{0}'")
public CardAssert assertCardText(String value) {
jdiAssert(element().getCardText().equals(value), Matchers.is(true));
jdiAssert(element().getCardText().equals(value), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' alt image attribute has text '{0}'")
public CardAssert assertAltImageAttribute(String value) {
jdiAssert(element().getImage().getAttribute("alt").contains(value), Matchers.is(true));
jdiAssert(element().getImage().getAttribute("alt").contains(value), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' src image attribute has text '{0}'")
public CardAssert assertSrcImageAttribute(String value) {
jdiAssert(element().getImage().getAttribute("src").contains(value), Matchers.is(true));
jdiAssert(element().getImage().getAttribute("src").contains(value), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has '{0}' buttons")
public CardAssert assertNumberOfButtonsOnCard(int number) {
jdiAssert(element().getButtons().size() == number, Matchers.is(true));
jdiAssert(element().getButtons().size() == number, Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class ChipsAssert extends UIAssert<ChipsAssert, Chips> {

@JDIAction("Assert that '{name}' enabled")
public ChipsAssert assertChipsIsEnabled() {
jdiAssert(element().enabled(), Matchers.is(true));
jdiAssert(element().enabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,109 +18,109 @@
public class DatepickerAssert extends UIAssert<DatepickerAssert, Datepicker> implements ITextAssert<DatepickerAssert> {
@JDIAction("Assert that '{name}' expanded")
public DatepickerAssert expanded() {
jdiAssert(element().isExpanded(), Matchers.is(true));
jdiAssert(element().isExpanded(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' collapsed")
public DatepickerAssert collapsed() {
jdiAssert(element().isCollapsed(), Matchers.is(true));
jdiAssert(element().isCollapsed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' focused")
public DatepickerAssert focused() {
jdiAssert(element().isFocused(), Matchers.is(true));
jdiAssert(element().isFocused(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has locale '{0}'")
public DatepickerAssert locale(final Locale locale) {
jdiAssert(element().isSelectedLocale(locale), Matchers.is(true));
jdiAssert(element().isSelectedLocale(locale), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has first input & change events '{0}'")
public DatepickerAssert firstInputChangeEvents(final List<String> firstInputChangeEvents) {
jdiAssert(element().isFirstInputChangeEvents(firstInputChangeEvents), Matchers.is(true));
jdiAssert(element().isFirstInputChangeEvents(firstInputChangeEvents), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has last input & change events '{0}'")
public DatepickerAssert lastInputChangeEvents(final List<String> lastInputChangeEvents) {
jdiAssert(element().isLastInputChangeEvents(lastInputChangeEvents), Matchers.is(true));
jdiAssert(element().isLastInputChangeEvents(lastInputChangeEvents), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has last change event '{0}'")
public DatepickerAssert lastChangeEvent(final String lastChangeEvent) {
jdiAssert(element().isLastChangeEvent(lastChangeEvent), Matchers.is(true));
jdiAssert(element().isLastChangeEvent(lastChangeEvent), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has last input event '{0}'")
public DatepickerAssert lastInputEvent(final String lastInputEvent) {
jdiAssert(element().isLastInputEvent(lastInputEvent), Matchers.is(true));
jdiAssert(element().isLastInputEvent(lastInputEvent), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has valid value")
public DatepickerAssert valid() {
jdiAssert(element().isValid(), Matchers.is(true));
jdiAssert(element().isValid(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has invalid value")
public DatepickerAssert invalid() {
jdiAssert(element().isInvalid(), Matchers.is(true));
jdiAssert(element().isInvalid(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' enabled")
public DatepickerAssert enabled() {
jdiAssert(element().isEnabled(), Matchers.is(true));
jdiAssert(element().isEnabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' disabled")
public DatepickerAssert disabled() {
jdiAssert(element().isDisabled(), Matchers.is(true));
jdiAssert(element().isDisabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has enabled toggle")
public DatepickerAssert enabledToggle() {
jdiAssert(element().isToggleEnabled(), Matchers.is(true));
jdiAssert(element().isToggleEnabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has disabled toggle")
public DatepickerAssert disabledToggle() {
jdiAssert(element().isToggleDisabled(), Matchers.is(true));
jdiAssert(element().isToggleDisabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has enabled input")
public DatepickerAssert enabledInput() {
jdiAssert(element().isInputEnabled(), Matchers.is(true));
jdiAssert(element().isInputEnabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has disabled input")
public DatepickerAssert disabledInput() {
jdiAssert(element().isInputDisabled(), Matchers.is(true));
jdiAssert(element().isInputDisabled(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has enabled values '{0}'")
public DatepickerAssert enabledNavigation(final String... navigationElements) {
jdiAssert(element().isEnabledNavigationElements(navigationElements), Matchers.is(true));
jdiAssert(element().isEnabledNavigationElements(navigationElements), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' has disabled values '{0}'")
public DatepickerAssert disabledNavigation(final String... navigationElements) {
jdiAssert(element().isDisabledNavigationElements(navigationElements), Matchers.is(true));
jdiAssert(element().isDisabledNavigationElements(navigationElements), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@

public class DialogAssert extends UIAssert<DialogAssert, Dialog> {
public DialogAssert opened() {
jdiAssert(element().isOpened(), Matchers.is(true));
jdiAssert(element().isOpened(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

public DialogAssert closed() {
jdiAssert(element().isClosed(), Matchers.is(true));
jdiAssert(element().isClosed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

public DialogAssert nameText(String name) {
jdiAssert(element().nameText(name), Matchers.is(true));
jdiAssert(element().nameText(name), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

public DialogAssert answerText(String answer) {
jdiAssert(element().answerText(answer), Matchers.is(true));
jdiAssert(element().answerText(answer), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
public class ExpansionPanelAssert extends UIAssert<ExpansionPanelAssert, ExpansionPanel> {
@JDIAction("Assert that '{name}' expanded")
public ExpansionPanelAssert expanded(final int indexNumber) {
jdiAssert(element().isExpanded(indexNumber), Matchers.is(true));
jdiAssert(element().isExpanded(indexNumber), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' collapsed")
public ExpansionPanelAssert collapsed(final int indexNumber) {
jdiAssert(element().isCollapsed(indexNumber), Matchers.is(true));
jdiAssert(element().isCollapsed(indexNumber), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public InputAssert value(String text) {

@JDIAction("Assert that '{name}' is readonly")
public InputAssert readonly() {
jdiAssert(element().isReadonly(), Matchers.is(true));
jdiAssert(element().isReadonly(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' is not readonly")
public InputAssert notReadonly() {
jdiAssert(element().isReadonly(), Matchers.is(false));
jdiAssert(element().isReadonly(), Matchers.is(false), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand All @@ -48,7 +48,7 @@ public InputAssert focused() {

@JDIAction("Assert that '{name}' is not focused")
public InputAssert notFocused() {
jdiAssert(element().isFocused(), Matchers.is(false));
jdiAssert(element().isFocused(), Matchers.is(false), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
public class MaterialSelectorAssert extends UIAssert<MaterialSelectorAssert, MaterialSelector> {
@JDIAction("Assert that '{name}' expanded")
public MaterialSelectorAssert expanded() {
jdiAssert(element().isExpanded(), Matchers.is(true));
jdiAssert(element().isExpanded(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that '{name}' collapsed")
public MaterialSelectorAssert collapsed() {
jdiAssert(element().isCollapsed(), Matchers.is(true));
jdiAssert(element().isCollapsed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

Expand Down Expand Up @@ -122,7 +122,7 @@ public MaterialSelectorAssert listDisabled(final String... values) {

@JDIAction("Assert that rgba({0}, {1}, {2}, {3}) is the specified color")
public MaterialSelectorAssert color(final int red, final int green, final int blue, final double a) {
jdiAssert(element().color(red, green, blue, a), Matchers.is(true));
jdiAssert(element().color(red, green, blue, a), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@
public class NestedDropdownMenuAssert extends UIAssert<NestedDropdownMenuAssert, NestedDropdownMenu> {
@JDIAction("Assert that {name} is expanded")
public NestedDropdownMenuAssert isExpanded() {
jdiAssert(element().isExpanded(), Matchers.is(true));
jdiAssert(element().isExpanded(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that {name} is closed")
public NestedDropdownMenuAssert isClosed() {
jdiAssert(element().isClosed(), Matchers.is(true));
jdiAssert(element().isClosed(), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that {name} expected value '{0} and actual value '{1}' are equals")
public NestedDropdownMenuAssert checkValue(String expectedValue, String actualValue) {
jdiAssert(element().checkValue(expectedValue, actualValue), Matchers.is(true));
jdiAssert(element().checkValue(expectedValue, actualValue), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that {name} option '{0}' is disabled")
public NestedDropdownMenuAssert isDisabledMenuWithIconsOption(String value) {
jdiAssert(element().isDisabledMenuWithIconsOption(value), Matchers.is(true));
jdiAssert(element().isDisabledMenuWithIconsOption(value), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}

@JDIAction("Assert that {name} option '{0}' is disabled")
public NestedDropdownMenuAssert isDisabledNestedMenuOption(String... values) {
jdiAssert(element().isDisabledNestedMenuOption(values), Matchers.is(true));
jdiAssert(element().isDisabledNestedMenuOption(values), Matchers.is(true), "ERROR MESSAGE IS REQUIRED");
return this;
}
}
Loading

0 comments on commit 32467b6

Please sign in to comment.