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

org.easymock.internal.matchers.Or Maven / Gradle / Ivy

Go to download

EasyMock provides an easy way to create Mock Objects for interfaces and classes generating them on the fly

There is a newer version: 5.5.0
Show newest version
/*
 * Copyright (c) 2001-2005 OFFIS, Tammo Freese.
 * This program is made available under the terms of the MIT License.
 */
package org.easymock.internal.matchers;

import java.util.Iterator;
import java.util.List;

import org.easymock.IArgumentMatcher;

public class Or implements IArgumentMatcher {

    private final List matchers;

    public Or(List matchers) {
        this.matchers = matchers;
    }

    public boolean matches(Object actual) {
        for (IArgumentMatcher matcher : matchers) {
            if (matcher.matches(actual)) {
                return true;
            }
        }
        return false;
    }

    public void appendTo(StringBuffer buffer) {
        buffer.append("or(");
        for (Iterator it = matchers.iterator(); it.hasNext();) {
            it.next().appendTo(buffer);
            if (it.hasNext()) {
                buffer.append(", ");
            }
        }
        buffer.append(")");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy