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

com.fitbur.mockito.internal.matchers.InstanceOf Maven / Gradle / Ivy

The newest version!
/*
 * Copyright (c) 2007 Mockito contributors
 * This program is made available under the terms of the MIT License.
 */

package com.fitbur.mockito.internal.matchers;

import com.fitbur.mockito.ArgumentMatcher;

import java.io.Serializable;


public class InstanceOf implements ArgumentMatcher, Serializable {

    private final Class clazz;

    public InstanceOf(Class clazz) {
        this.clazz = clazz;
    }

    public boolean matches(Object actual) {
        return (actual != null) && clazz.isAssignableFrom(actual.getClass());
    }

    public String toString() {
        return "isA(" + clazz.getName() + ")";
    }
}