1/* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5package org.mockito.internal.util; 6 7import org.mockito.MockingDetails; 8 9/** 10 * Class to inspect any object, and identify whether a particular object is either a mock or a spy. This is 11 * a wrapper for {@link org.mockito.internal.util.MockUtil}. 12 */ 13public class DefaultMockingDetails implements MockingDetails { 14 15 private Object toInspect; 16 private MockUtil delegate; 17 18 public DefaultMockingDetails(Object toInspect, MockUtil delegate){ 19 this.toInspect = toInspect; 20 this.delegate = delegate; 21 } 22 /** 23 * Find out whether the object is a mock. 24 * @return true if the object is a mock or a spy. 25 */ 26 public boolean isMock(){ 27 return delegate.isMock( toInspect ); 28 } 29 30 /** 31 * Find out whether the object is a spy. 32 * @return true if the object is a spy. 33 */ 34 public boolean isSpy(){ 35 return delegate.isSpy( toInspect ); 36 } 37} 38 39