adamsaghy commented on code in PR #4144: URL: https://github.com/apache/fineract/pull/4144#discussion_r1831094939
########## fineract-provider/src/test/java/org/apache/fineract/accounting/productaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceTest.java: ########## @@ -0,0 +1,124 @@ +/** + * 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.accounting.productaccountmapping.service; + +import static org.mockito.Mockito.any; +import static org.mockito.Mockito.anyInt; +import static org.mockito.Mockito.anyLong; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.doAnswer; +import static org.mockito.Mockito.eq; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import java.util.Locale; +import org.apache.fineract.accounting.common.AccountingConstants.LoanProductAccountingParams; +import org.apache.fineract.accounting.common.AccountingRuleType; +import org.apache.fineract.accounting.glaccount.domain.GLAccountType; +import org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMappingRepository; +import org.apache.fineract.accounting.producttoaccountmapping.serialization.ProductToGLAccountMappingFromApiJsonDeserializer; +import org.apache.fineract.accounting.producttoaccountmapping.service.SavingsProductToGLAccountMappingHelper; +import org.apache.fineract.accounting.producttoaccountmapping.service.ShareProductToGLAccountMappingHelper; +import org.apache.fineract.infrastructure.core.api.JsonCommand; +import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper; +import org.apache.fineract.portfolio.PortfolioProductType; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; + +class ProductToGLAccountMappingWritePlatformServiceImplTest { + + @Mock + private ProductToGLAccountMappingRepository glAccountMappingRepository; + + @Mock + private LoanProductToGLAccountMappingHelper loanProductToGLAccountMappingHelper; + + @Mock + private ProductToGLAccountMappingFromApiJsonDeserializer deserializer; + + @Mock + private SavingsProductToGLAccountMappingHelper savingsProductToGLAccountMappingHelper; + + @Mock + private ShareProductToGLAccountMappingHelper shareProductToGLAccountMappingHelper; + + @Mock + private FromJsonHelper fromApiJsonHelper; + + @Mock + private JsonCommand command; + + @Mock + private JsonElement element; + + private ProductToGLAccountMappingWritePlatformServiceImpl service; + + private static final Long LOAN_PRODUCT_ID = 1L; + private static final int PRODUCT_TYPE = PortfolioProductType.LOAN.getValue(); + private static final int FINANCIAL_ACCOUNT_TYPE_EXPENSE = GLAccountType.EXPENSE.getValue(); + private static final String CHARGE_OFF_FRAUD_EXPENSE = LoanProductAccountingParams.CHARGE_OFF_FRAUD_EXPENSE.getValue(); + + @BeforeEach Review Comment: I dont see any added value of having classes that are fully mocked out... I would rather see integration test that is testing whether incoming request got saved properly, and we can fetch created mappings. It can be updated, etc. -- 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]
