diff --git a/src/main/java/cl/transbank/webpay/oneclick/OneclickMallInscription.java b/src/main/java/cl/transbank/webpay/oneclick/OneclickMallInscription.java index 2643f11..bdc6ee5 100644 --- a/src/main/java/cl/transbank/webpay/oneclick/OneclickMallInscription.java +++ b/src/main/java/cl/transbank/webpay/oneclick/OneclickMallInscription.java @@ -11,7 +11,6 @@ import cl.transbank.webpay.exception.InscriptionDeleteException; import cl.transbank.webpay.exception.InscriptionFinishException; import cl.transbank.webpay.exception.InscriptionStartException; -import cl.transbank.webpay.exception.TransbankHttpApiException; import cl.transbank.webpay.oneclick.requests.InscriptionDeleteRequest; import cl.transbank.webpay.oneclick.requests.InscriptionStartRequest; import cl.transbank.webpay.oneclick.responses.OneclickMallInscriptionFinishResponse; @@ -131,8 +130,6 @@ public boolean delete(String tbkUser, String username) options ); return true; - } catch (TransbankHttpApiException e) { - return false; } catch (TransbankException e) { throw new InscriptionDeleteException(e); } diff --git a/src/test/java/webpayplus/OneclickMallDeferredTest.java b/src/test/java/webpayplus/OneclickMallDeferredTest.java index 1ab0b76..b0d07bc 100644 --- a/src/test/java/webpayplus/OneclickMallDeferredTest.java +++ b/src/test/java/webpayplus/OneclickMallDeferredTest.java @@ -107,11 +107,16 @@ void delete() throws IOException, InscriptionDeleteException { assertTrue(response); } @Test - void deleteNotFound() throws IOException, InscriptionDeleteException { + public void deleteNotFound() throws IOException { String url = String.format("/%s/inscriptions", apiUrl); setResponseDeleteError(url, HttpStatusCode.NOT_FOUND_404); - final boolean response = (new Oneclick.MallInscription(option)).delete(tbkUser, username); - assertFalse(response); + + try { + new Oneclick.MallInscription(option).delete(tbkUser, username); + fail("Expected InscriptionDeleteException to be thrown"); + } catch (InscriptionDeleteException e) { + assertNotNull(e); + } } @Test void authorize() throws IOException, TransactionAuthorizeException { diff --git a/src/test/java/webpayplus/OneclickMallTest.java b/src/test/java/webpayplus/OneclickMallTest.java index edb4abb..4a7d38c 100644 --- a/src/test/java/webpayplus/OneclickMallTest.java +++ b/src/test/java/webpayplus/OneclickMallTest.java @@ -109,12 +109,18 @@ void delete() throws IOException, InscriptionDeleteException { } @Test - void deleteNotFound() throws IOException, InscriptionDeleteException { + public void deleteNotFound() throws IOException { String url = String.format("/%s/inscriptions", apiUrl); setResponseDeleteError(url, HttpStatusCode.NOT_FOUND_404); - final boolean response = (new Oneclick.MallInscription(option)).delete(tbkUser, username); - assertFalse(response); + + try { + new Oneclick.MallInscription(option).delete(tbkUser, username); + fail("Expected InscriptionDeleteException to be thrown"); + } catch (InscriptionDeleteException e) { + assertNotNull(e); + } } + @Test void authorize() throws IOException, TransactionAuthorizeException { OneclickMallTransactionStatusResponse expectedResponse = generateStatusResponse();