Search in sources :

Example 1 with BaseDescription

use of org.hamcrest.BaseDescription in project junit4 by junit-team.

the class Guesser method reguesses.

@Override
public List<ReguessableValue> reguesses(AssumptionViolatedException e) {
    final ArrayList<ReguessableValue> returnThis = new ArrayList<ReguessableValue>();
    e.describeTo(new BaseDescription() {

        @Override
        protected void append(char arg0) {
        }

        boolean expectedSeen = false;

        Object expected = null;

        @Override
        public Description appendValue(Object value) {
            noteValue(value);
            return super.appendValue(value);
        }

        private void noteValue(Object value) {
            if (!expectedSeen) {
                expected = value;
                expectedSeen = true;
                return;
            }
            GuessMap newGuesses = guesses.replaceGuess(expected, value);
            returnThis.add(new Guesser<T>(getType(), newGuesses));
        }
    });
    return returnThis;
}
Also used : BaseDescription(org.hamcrest.BaseDescription) Description(org.hamcrest.Description) BaseDescription(org.hamcrest.BaseDescription) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 BaseDescription (org.hamcrest.BaseDescription)1 Description (org.hamcrest.Description)1