public class OrserTest { @Inject private OrderServer orderServer; @Before private void setUp(){ Guice.createInjector(new ServerModule()).injectMembers(this); } @Test public void testSendToPayment(){ orderServer.sendToOrderPaid(789L); } }
尝试使用 @BeforeEach 代替 @Before 注解。
是引入搞错了吧