Aresxue commented on PR #92: URL: https://github.com/apache/dubbo-hessian-lite/pull/92#issuecomment-3326263863
> > How would you like me to improve it? > > All unit test classes that related to this PR should be added collection test cases. the work might be easier if you have AI assistant tools, tell the AI assistant tool to add collection test case to another test class refer to the test class that has beed added manually. e.g., `testCollection` method was generated by `lingma` that i told it `generate colllection test case for SerializeTest based on LongAdderTest` (i wrote above), > > ``` > public class SerializeTest extends SerializeTestBase { > @Test > void test() throws IOException { > AppResult<List<ComplainDto>> result = new AppResult<>(); > ComplainDto complainDto = new ComplainDto(); > complainDto.setAppealReason("1"); > complainDto.setAppealState(2); > complainDto.setAppealType((byte) 3); > complainDto.setClass1Name("4"); > complainDto.setClass2Name("5"); > complainDto.setClass3Name("6"); > complainDto.setComplainDate("7"); > complainDto.setComplainOi(Arrays.asList("8")); > complainDto.setComplainOrderId("9"); > complainDto.setComplainResult("10"); > complainDto.setComplainStatus((byte) 11); > complainDto.setComplainStatusName("12"); > complainDto.setCustomerName("13"); > complainDto.setRemark("14"); > complainDto.setShowType(Boolean.TRUE); > complainDto.setSurplusDate("15"); > complainDto.setTotal(BigDecimal.valueOf(16L)); > complainDto.setTotalType((byte) 17); > complainDto.setUserAccessory(Arrays.asList("18")); > result.setData(Arrays.asList(complainDto)); > > Assertions.assertEquals(result, baseHessian2Serialize(result)); > Assertions.assertEquals(result, hessian3ToHessian3(result)); > Assertions.assertEquals(result, hessian4ToHessian3(result)); > Assertions.assertEquals(result, hessian3ToHessian4(result)); > > result.setData(Arrays.asList(complainDto, complainDto)); > > Assertions.assertEquals(result, baseHessian2Serialize(result)); > Assertions.assertEquals(result, hessian3ToHessian3(result)); > Assertions.assertEquals(result, hessian4ToHessian3(result)); > Assertions.assertEquals(result, hessian3ToHessian4(result)); > } > > // generated by lingma > @Test > void testCollection() throws IOException { > ComplainDto complainDto = new ComplainDto(); > complainDto.setAppealReason("1"); > complainDto.setAppealState(2); > complainDto.setAppealType((byte) 3); > complainDto.setClass1Name("4"); > complainDto.setClass2Name("5"); > complainDto.setClass3Name("6"); > complainDto.setComplainDate("7"); > complainDto.setComplainOi(Arrays.asList("8")); > complainDto.setComplainOrderId("9"); > complainDto.setComplainResult("10"); > complainDto.setComplainStatus((byte) 11); > complainDto.setComplainStatusName("12"); > complainDto.setCustomerName("13"); > complainDto.setRemark("14"); > complainDto.setShowType(Boolean.TRUE); > complainDto.setSurplusDate("15"); > complainDto.setTotal(BigDecimal.valueOf(16L)); > complainDto.setTotalType((byte) 17); > complainDto.setUserAccessory(Arrays.asList("18")); > > List<ComplainDto> list = new ArrayList<>(); > list.add(complainDto); > list.add(complainDto); > List<ComplainDto> list2 = baseHessian2Serialize(list); > Assertions.assertEquals(list.size(), list2.size()); > Assertions.assertSame(list2.get(0), list2.get(1)); > Assertions.assertEquals(complainDto, list2.get(0)); > } > } > ``` ```java @Test void test() throws IOException { TestAnnotation annotation = AnnotatedClass.class.getAnnotation(TestAnnotation.class); TestAnnotation testAnnotation = baseHessian2Serialize(annotation); Assertions.assertEquals(annotation, testAnnotation); } @Test void testAnnotationCollection() throws IOException { TestAnnotation annotation = AnnotatedClass.class.getAnnotation(TestAnnotation.class); List<TestAnnotation> list = new ArrayList<>(); list.add(annotation); list.add(annotation); List<TestAnnotation> result = baseHessian2Serialize(list); Assertions.assertEquals(list.size(), result.size()); Assertions.assertSame(result.get(0), result.get(1)); Assertions.assertEquals(annotation, result.get(0)); } ``` ```java @Test void test() throws IOException { TestAnnotation annotation = AnnotatedClass.class.getAnnotation(TestAnnotation.class); TestAnnotation testAnnotation = baseHessian2Serialize(annotation); Assertions.assertEquals(annotation, testAnnotation); List<TestAnnotation> list = new ArrayList<>(); list.add(annotation); list.add(annotation); List<TestAnnotation> result = baseHessian2Serialize(list); Assertions.assertEquals(list.size(), result.size()); Assertions.assertSame(result.get(0), result.get(1)); Assertions.assertEquals(annotation, result.get(0)); } ``` Which of the above two styles do you prefer? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org