org.hamcrest.SelfDescribing Java Examples

The following examples show how to use org.hamcrest.SelfDescribing. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MatchersPrinter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private List<SelfDescribing> applyPrintSettings(List<Matcher> matchers, PrintSettings printSettings) {
    List<SelfDescribing> withPrintSettings = new LinkedList<SelfDescribing>();
    int i = 0;
    for (final Matcher matcher : matchers) {
        if (matcher instanceof ContainsExtraTypeInformation && printSettings.extraTypeInfoFor(i)) {
            withPrintSettings.add(((ContainsExtraTypeInformation) matcher).withExtraTypeInfo());
        } else {
            withPrintSettings.add(matcher);
        }
        i++;
    }
    return withPrintSettings;
}
 
Example #2
Source File: HttpRequestMatcher.java    From cloudstack with Apache License 2.0 5 votes vote down vote up
public SelfDescribing withExtraTypeInfo() {
    return new SelfDescribing() {
        @Override
        public void describeTo(final Description description) {
            description.appendText("(" + wanted.getClass().getSimpleName() + ") ").appendText(describe(wanted));
        }
    };
}
 
Example #3
Source File: MatchersPrinter.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
private List<SelfDescribing> applyPrintSettings(List<Matcher> matchers, PrintSettings printSettings) {
    List<SelfDescribing> withPrintSettings = new LinkedList<SelfDescribing>();
    int i = 0;
    for (final Matcher matcher : matchers) {
        if (matcher instanceof ContainsExtraTypeInformation && printSettings.extraTypeInfoFor(i)) {
            withPrintSettings.add(((ContainsExtraTypeInformation) matcher).withExtraTypeInfo());
        } else {
            withPrintSettings.add(matcher);
        }
        i++;
    }
    return withPrintSettings;
}
 
Example #4
Source File: HttpRequestMatcher.java    From cosmic with Apache License 2.0 5 votes vote down vote up
public SelfDescribing withExtraTypeInfo() {
    return new SelfDescribing() {
        @Override
        public void describeTo(final Description description) {
            description.appendText("(" + wanted.getClass().getSimpleName() + ") ").appendText(describe(wanted));
        }
    };
}
 
Example #5
Source File: RecordingDescription.java    From cortado with Apache License 2.0 5 votes vote down vote up
@Override
public Description appendList(String start, String separator, String end, Iterable<? extends SelfDescribing> values) {
    append(start);
    boolean first = true;
    for (SelfDescribing selfDescribing : values) {
        if (!first) {
            append(separator);
        } else {
            first = false;
        }
        selfDescribing.describeTo(this);
    }
    append(end);
    return this;
}
 
Example #6
Source File: RecordingDescription.java    From cortado with Apache License 2.0 4 votes vote down vote up
@Override
public Description appendDescriptionOf(SelfDescribing value) {
    value.describeTo(this);
    return this;
}
 
Example #7
Source File: SwtBotButton.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
public SwtBotButton(final Button button, final SelfDescribing description) {
  super(button, description);
}
 
Example #8
Source File: FixedDescription.java    From ogham with Apache License 2.0 4 votes vote down vote up
@Override
public Description appendDescriptionOf(SelfDescribing value) {
	return this;
}
 
Example #9
Source File: FixedDescription.java    From ogham with Apache License 2.0 4 votes vote down vote up
@Override
public Description appendList(String start, String separator, String end, Iterable<? extends SelfDescribing> values) {
	return this;
}
 
Example #10
Source File: SWTBotTableCombo.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
public SWTBotTableCombo(TableCombo widget,  SelfDescribing description){
	super(widget,description);
}
 
Example #11
Source File: Equals.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public SelfDescribing withExtraTypeInfo() {
    return new SelfDescribing() {
        public void describeTo(Description description) {
            description.appendText(describe("("+ wanted.getClass().getSimpleName() +") " + wanted));
        }};
}
 
Example #12
Source File: TestBase.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
protected static String describe(SelfDescribing m) {
    return StringDescription.toString(m);
}
 
Example #13
Source File: Equals.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public SelfDescribing withExtraTypeInfo() {
    return new SelfDescribing() {
        public void describeTo(Description description) {
            description.appendText(describe("("+ wanted.getClass().getSimpleName() +") " + wanted));
        }};
}
 
Example #14
Source File: TestBase.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
protected static String describe(SelfDescribing m) {
    return StringDescription.toString(m);
}
 
Example #15
Source File: Matchers.java    From totallylazy with Apache License 2.0 4 votes vote down vote up
public static Function1<SelfDescribing, String> description() {
    return selfDescribing -> asString(selfDescribing);
}
 
Example #16
Source File: SarosSWTBotChatInput.java    From saros with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance of this object.
 *
 * @param w the widget.
 * @param description the description of the widget, this will be reported by {@link #toString()}
 * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
 */
public SarosSWTBotChatInput(ChatInput w, SelfDescribing description)
    throws WidgetNotFoundException {
  super(w, description);
  this.styledText = new SWTBotStyledText(getStyledText(w));
}
 
Example #17
Source File: SWTBotTableComboColumn.java    From bonita-studio with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance of this object.
 * 
 * @param w the widget.
 * @param parent the parent table.
 * @param description the description of the widget, this will be reported by {@link #toString()}
 * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
 * @since 2.0
 */
public SWTBotTableComboColumn(TableColumn w, Table parent, SelfDescribing description) throws WidgetNotFoundException {
	super(w, description);
	this.parent = parent;
}
 
Example #18
Source File: SarosSWTBotChatLinePartnerChangeSeparator.java    From saros with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance of this object.
 *
 * @param w the widget.
 * @param description the description of the widget, this will be reported by {@link #toString()}
 * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
 */
public SarosSWTBotChatLinePartnerChangeSeparator(
    ChatLinePartnerChangeSeparator w, SelfDescribing description) throws WidgetNotFoundException {
  super(w, description);
}
 
Example #19
Source File: SarosSWTBotChatLine.java    From saros with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new instance of this object.
 *
 * @param w the widget.
 * @param description the description of the widget, this will be reported by {@link #toString()}
 * @throws WidgetNotFoundException if the widget is <code>null</code> or widget has been disposed.
 */
public SarosSWTBotChatLine(ChatLine w, SelfDescribing description)
    throws WidgetNotFoundException {
  super(w, description);
}
 
Example #20
Source File: NewWizardDialog.java    From tmxeditor8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param shell
 * @param description
 */
public NewWizardDialog(Shell shell, SelfDescribing description) {
	super(shell, description);
}
 
Example #21
Source File: NewWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 2 votes vote down vote up
/**
 * @param shell
 * @param description
 */
public NewWizardDialog(Shell shell, SelfDescribing description) {
	super(shell, description);
}
 
Example #22
Source File: SwtBotRadio.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Instantiates a new {@link SwtBotRadio} with the given widget.
 * 
 * @param w
 *          the widget, must not be {@code null}
 * @param description
 *          the description of the widget, this will be reported by {@link SelfDescribing#toString()}, may be {@code null}
 */
public SwtBotRadio(final Button w, final SelfDescribing description) {
  super(w, description);
}
 
Example #23
Source File: ContainsExtraTypeInformation.java    From astor with GNU General Public License v2.0 votes vote down vote up
SelfDescribing withExtraTypeInfo(); 
Example #24
Source File: ContainsExtraTypeInformation.java    From astor with GNU General Public License v2.0 votes vote down vote up
SelfDescribing withExtraTypeInfo();