delei commented on code in PR #1031: URL: https://github.com/apache/fesod/pull/1031#discussion_r3838677766
########## fesod-sheet/src/test/java/org/apache/fesod/sheet/read/listener/ModelBuildEventListenerTest.java: ########## @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.fesod.sheet.read.listener; + +import java.util.Collections; +import java.util.List; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; +import org.apache.fesod.sheet.annotation.ExcelProperty; +import org.apache.fesod.sheet.testkit.Tags; +import org.apache.fesod.sheet.testkit.base.AbstractExcelTest; +import org.apache.fesod.sheet.testkit.enums.ExcelFormat; +import org.apache.fesod.sheet.testkit.helpers.RoundTripHelper; +import org.apache.fesod.sheet.testkit.params.ExcelFormatSource; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.params.ParameterizedTest; + +/** + * Tests the field-assignment fallback in {@link ModelBuildEventListener} for models whose mapped + * property has no standard JavaBeans setter. + */ +@Tag(Tags.ROUND_TRIP) +class ModelBuildEventListenerTest extends AbstractExcelTest { + + @Getter + public static class GetterOnlyData { + @ExcelProperty("name") + public String name; + } + + public static class InheritedGetterOnlyData extends GetterOnlyData {} + + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static class PrivateGetterOnlyData { Review Comment: I re-read and retested the scenario in this old [issue](https://github.com/alibaba/easyexcel/issues/3524), and all of them passed the tests. Could you please provide an example for this unit test? Non-standard set method ```Java // Non-standard set method public String setName(String name) { return this.name = name; } ``` Use `@Accessors(chain = true)` ```Java @Getter @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) public static class PrivateGetterOnlyData { .... } ``` If I have missed anything, please feel free to add it. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
