vidakovic commented on code in PR #2324: URL: https://github.com/apache/fineract/pull/2324#discussion_r871065846
########## fineract-provider/src/test/java/org/apache/fineract/portfolio/loanaccount/domain/LoanTest.java: ########## @@ -0,0 +1,88 @@ +/** + * 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.fineract.portfolio.loanaccount.domain; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.mockito.Mockito.mock; + +import java.math.BigDecimal; +import java.util.Collection; +import java.util.Collections; +import org.apache.fineract.infrastructure.core.service.DateUtils; +import org.apache.fineract.portfolio.charge.domain.Charge; +import org.apache.fineract.portfolio.charge.domain.ChargeCalculationType; +import org.apache.fineract.portfolio.charge.domain.ChargePaymentMode; +import org.apache.fineract.portfolio.charge.domain.ChargeTimeType; +import org.junit.jupiter.api.Test; +import org.springframework.test.util.ReflectionTestUtils; + +/** + * Tests {@link Loan}. + */ +public class LoanTest { + + /** + * Tests {@link Loan#getCharges()} with charges. + */ + @Test + public void testGetChargesWithCharges() { + Loan loan = new Loan(); + ReflectionTestUtils.setField(loan, "charges", Collections.singleton(buildLoanCharge())); Review Comment: Note for later: I would suggest that we do sooner than later a vote on if we really want to keep this immutability thing? Perfectly valid way to set that class attribute given the state of the source code... but we have this situation all over the place and pretty much every one's strategy is to copy objects... which is really wasteful. I'd suggest: simple Lombok annotations (getters and setters, constructors, builder). There is a GSoC project on the way that we can use for that. The student promised to submit a plan of attack... any day. FYI -- 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]
