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 org.junit.Test; 8 import org.mockito.InjectMocks; 9 import org.mockito.Spy; 10 import org.mockito.internal.util.MockUtil; 11 import org.mockitoutil.TestBase; 12 13 import java.util.LinkedList; 14 import java.util.List; 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; setSpy(List<?> spy)23 public void setSpy(List<?> spy) { 24 this.spy = spy; 25 } 26 } 27 28 @Test shouldDoStuff()29 public void shouldDoStuff() throws Exception { 30 MockUtil.isMock(hasSpy.spy); 31 } 32 } 33