Pass compiling but failed in test


(bruceli97) #1
import javax.ws.rs.WebApplicationException;
   @Test(expected = WebApplicationException.class)
   public void test_getQuote_shouldCatchInvalidRequestException() {
      QuoteService service = new QuoteService(manager, quoteRepository, accountRepository,
         aabbRepository, orderManager, securityContext, transaction);
      when(quoteRepository.getQuote(BigInteger.ONE)).thenThrow(invalidRequestException);
      service.getQuote(BigInteger.ONE);
   }
dependencies {
  testCompile(['com.sun.jersey:jersey-client:1.3'],['com.sun.jersey:jersey-server:1.3'],['jsr311:jsr311:1'],['org.mockito:mockito-all:1.8.2'],['jmockit:jmockit:1'])
  compile project(path: ':main')
 }

It pass java compiling but failed in test. Here is the error message:

Test test_postQuoteRequest_shouldCatchInvalidRequestException(ca.aabb.rest.service.QuoteServiceTest) FAILED: java.lang.Exception: Unexpected exception, expected<javax.ws.rs.WebApplicationException> but was<java.lang.NoClassDefFoundError>

Don’t know why gradle can not find javax.ws.rs.WebApplicationException. Anyone can hekp me please? Thanks.


(bruceli97) #2

Not familiar with forum format, there is error message: Test test_postQuoteRequest_shouldCatchInvalidRequestException(ca.aabb.rest.service.QuoteServiceTest) FAILED: java.lang.Exception: Unexpected exception, expected<javax.ws.rs.WebApplicationException> but was<java.lang.NoClassDefFoundError>