From 5fbe02061ddd1c86e9faaae2b09afed2a4955a7f Mon Sep 17 00:00:00 2001 From: Jerry Lee Date: Mon, 4 Jan 2021 21:16:56 +0800 Subject: [PATCH] ! fix UT fail of archetype:generate project by cola-framework-archetype-web --- .../start/src/test/java/test/CustomerServiceTest.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/test/java/test/CustomerServiceTest.java b/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/test/java/test/CustomerServiceTest.java index fe2546532..bda87037c 100644 --- a/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/test/java/test/CustomerServiceTest.java +++ b/cola-archetypes/cola-archetype-web/src/main/resources/archetype-resources/start/src/test/java/test/CustomerServiceTest.java @@ -4,10 +4,10 @@ package ${package}.test; import com.alibaba.cola.dto.Response; -import com.alibaba.cola.exception.BizException; import ${package}.api.CustomerServiceI; import ${package}.dto.CustomerAddCmd; import ${package}.dto.data.CustomerDTO; +import ${package}.dto.data.ErrorCode; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -49,7 +49,7 @@ public void testCustomerAddSuccess(){ Assert.assertTrue(response.isSuccess()); } - @Test(expected = BizException.class) + @Test public void testCustomerAddCompanyNameConflict(){ //1.prepare CustomerAddCmd customerAddCmd = new CustomerAddCmd(); @@ -60,8 +60,7 @@ public void testCustomerAddCompanyNameConflict(){ //2.execute Response response = customerService.addCustomer(customerAddCmd); - //3.Exception - //Assert.assertEquals(ErrorCode.B_CUSTOMER_companyNameConflict.getErrCode(), response.getErrCode()); - + //3.assert error + Assert.assertEquals(ErrorCode.B_CUSTOMER_companyNameConflict.getErrCode(), response.getErrCode()); } }