0
でのif-else条件を使用している間、私は私が使用しています一つの試験方法ではそのための機能テストのためにJmockitを使用していますjava.langのJmockit @Testメソッド
以下のような条件をエラーを取得した場合、他の.IllegalArgumentException: com.hp.it.sbs.obligation.service.ObligationServiceImplMockTest_old $ 1での期待ブロック内の無効な条件文 (ObligationServiceImplMockTest_old.java:2560) com.hp.it.sbs.obligation.service.ObligationServiceImplMockTest_oldで。 .setExpectationsForOrchestration(ObligationServiceImpl MockTest_old.java:2547) com.hp.it.sbs.obligation.service.ObligationServiceImplMockTest_old.testRetrieveServiceObligationResponsesByServiceObligationRequests(ObligationServiceImplMockTest_old.java:169) れるjava.langでsun.reflect.NativeMethodAccessorImpl.invoke0(ネイティブメソッド)で で。 reflect.Method.invoke(Method.java:597)at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner org.eclipse.jdt.internal.junit.runnerでorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) で.TestExecution.run(TestExecution.java:38) .RemoteTestRu org.eclipse.jdt.internal.junit.runnerでnner.runTests(RemoteTestRunner.java:675) でorg.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) 。 RemoteTestRunner.main(RemoteTestRunner.java:192)@Ignore @Test(expected = CoreServiceException.class) public final void setExpectationsForOrchestration(@Mocked final int type, @Mocked final Object request, @Mocked final String responseFile) throws Exception{ new NonStrictExpectations() { { XStream xstream = new XStream(); File obligationResponseList = new File(mockDataDir + responseFile); FileReader xmlReader = new FileReader( obligationResponseList); if (type == 1) { orchestrationInstance .retrieveServiceObligationResponseByServiceObligationRequest( (ServiceObligationRequest) request, (AppContext) any); } else if (type ==2) { orchestrationInstance .retrieveServiceObligationEntitlementResponseByServiceObligationEntitlementRequest( (ServiceObligationEntitlementRequest) request, (AppContext) any); } else if (type == 3) { orchestrationInstance .retrieveServiceObligationHeaderOfferResponseByServiceObligationProductRequest( (ServiceObligationProductRequest) request, (AppContext) any); } else if (type == 4) { orchestrationInstance .retrieveServiceObligationCustomerDocumentByServiceObligationRequest( (ServiceObligationRequest) request, (AppContext) any); } result = xstream.fromXML(xmlReader); } }; } But while running i am getting this error
誰でもこれに答えることができます。私はjmockitバージョン1.21を使用しています。