All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.googlecode.gwt.test.assertions.GwtWritableAssertionInfo Maven / Gradle / Ivy

There is a newer version: 0.63
Show newest version
package com.googlecode.gwt.test.assertions;

import org.assertj.core.api.WritableAssertionInfo;
import org.assertj.core.description.Description;
import org.assertj.core.description.TextDescription;

/**
 * Writable information about a GWT assertion.
 *
 * @author Gael Lazzari
 */
class GwtWritableAssertionInfo extends WritableAssertionInfo {

    private String prefix;

    @Override
    public Description description() {
        return (prefix == null) ? super.description()
                : new TextDescription(computeDescribitionText());
    }

    @Override
    public String descriptionText() {
        return (prefix == null) ? super.descriptionText() : computeDescribitionText();
    }

    public String prefix() {
        return prefix;
    }

    public void prefix(String prefix) {
        this.prefix = prefix;
    }

    public Description superDescription() {
        return super.description();
    }

    private String computeDescribitionText() {
        StringBuilder sb = new StringBuilder();
        sb.append(prefix.trim());

        Description d = super.description();
        if (d != null) {
            sb.append(" ").append(d.value());
        }
        return sb.toString();
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy