How to auto inject with test mode?


(Jian5863) #1

hey,guys,i worked with play 1.4.4 and i meet a problem this days.
in test mode (play test),it can’t auto inject object for those service.
here is an example:
public class TestServiceImplTest extends UnitTest{
@Inject
private TestService testService;
@Test
public void sum() throws Exception {
int sum = testService.sum(1,1);
assertEquals(2,sum);
}

}
}
testService is null, Does anyone know how to solve it?