|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| InstanceOf.java | - | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* | |
| 2 | * Copyright (c) 2001-2006 OFFIS, Tammo Freese. | |
| 3 | * This program is made available under the terms of the MIT License. | |
| 4 | */ | |
| 5 | package org.easymock.internal.matchers; | |
| 6 | ||
| 7 | import org.easymock.IArgumentMatcher; | |
| 8 | ||
| 9 | public class InstanceOf implements IArgumentMatcher { | |
| 10 | ||
| 11 | private final Class<?> clazz; | |
| 12 | ||
| 13 | 3 | public InstanceOf(Class clazz) { |
| 14 | 3 | this.clazz = clazz; |
| 15 | } | |
| 16 | ||
| 17 | 7 | public boolean matches(Object actual) { |
| 18 | 7 | return (actual != null) && clazz.isAssignableFrom(actual.getClass()); |
| 19 | } | |
| 20 | ||
| 21 | 3 | public void appendTo(StringBuffer buffer) { |
| 22 | 3 | buffer.append("isA(" + clazz.getName() + ")"); |
| 23 | } | |
| 24 | } |
|
||||||||||