View Javadoc
1 /* Copyright (c) 2000-2003, jMock.org. See bundled LICENSE.txt */ 2 package org.jmock.constraint; 3 4 import org.jmock.Constraint; 5 6 /*** 7 * Tests whether the value is an instance of a class. 8 */ 9 public class IsInstanceOf implements Constraint { 10 private Class _class; 11 12 /*** 13 * Creates a new instance of IsInstanceOf 14 * 15 * @param theclass The predicate evaluates to true for instances of this class 16 * or one of its subclasses. 17 */ 18 public IsInstanceOf(Class theclass) { 19 _class = theclass; 20 } 21 22 public boolean eval(Object arg) { 23 return _class.isInstance(arg); 24 } 25 26 public String toString() { 27 return "an instance of <" + _class.getName() + ">"; 28 } 29 }

This page was automatically generated by Maven