1 /* 2 * Copyright (c) 2007 Mockito contributors 3 * This program is made available under the terms of the MIT License. 4 */ 5 package org.mockitousage.annotation; 6 7 import java.util.LinkedList; 8 import java.util.List; 9 10 import org.junit.Test; 11 import org.mockito.InjectMocks; 12 import org.mockito.Spy; 13 import org.mockito.internal.util.MockUtil; 14 import org.mockitoutil.TestBase; 15 16 public class SpyInjectionTest extends TestBase { 17 18 @Spy List<Object> spy = new LinkedList<Object>(); 19 @InjectMocks HasSpy hasSpy = new HasSpy(); 20 21 static class HasSpy { 22 private List<?> spy; 23 setSpy(List<?> spy)24 public void setSpy(List<?> spy) { 25 this.spy = spy; 26 } 27 } 28 29 @Test shouldDoStuff()30 public void shouldDoStuff() throws Exception { 31 MockUtil.isMock(hasSpy.spy); 32 } 33 } 34