adamsaghy commented on code in PR #4876:
URL: https://github.com/apache/fineract/pull/4876#discussion_r2272643748


##########
integration-tests/src/test/java/org/apache/fineract/integrationtests/SavingsProductCreationIntegrationTest.java:
##########
@@ -0,0 +1,111 @@
+/**
+ * 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.integrationtests;
+
+import io.restassured.builder.RequestSpecBuilder;
+import io.restassured.builder.ResponseSpecBuilder;
+import io.restassured.http.ContentType;
+import io.restassured.specification.RequestSpecification;
+import io.restassured.specification.ResponseSpecification;
+import org.apache.fineract.client.models.GetSavingsProductsProductIdResponse;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.apache.fineract.integrationtests.common.accounting.Account;
+import org.apache.fineract.integrationtests.common.accounting.AccountHelper;
+import 
org.apache.fineract.integrationtests.common.savings.SavingsAccountHelper;
+import 
org.apache.fineract.integrationtests.common.savings.SavingsProductHelper;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class SavingsProductCreationIntegrationTest {
+
+    private static final Logger LOG = 
LoggerFactory.getLogger(SavingsProductCreationIntegrationTest.class);
+    private static ResponseSpecification responseSpec;
+    private static RequestSpecification requestSpec;
+    private AccountHelper accountHelper;
+    private SavingsAccountHelper savingsAccountHelper;
+    public static final String MINIMUM_OPENING_BALANCE = "1000.0";
+
+    @BeforeEach
+    public void setup() {
+        Utils.initializeRESTAssured();
+        this.requestSpec = new 
RequestSpecBuilder().setContentType(ContentType.JSON).build();
+        this.requestSpec.header("Authorization", "Basic " + 
Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+        this.responseSpec = new 
ResponseSpecBuilder().expectStatusCode(200).build();
+        this.accountHelper = new AccountHelper(this.requestSpec, 
this.responseSpec);
+        this.savingsAccountHelper = new SavingsAccountHelper(this.requestSpec, 
this.responseSpec);
+    }
+
+    @Test
+    public void testStandardSavingsProductCreation_DoesNotAllowOverdraft() {
+        // --- ARRANGE ---
+        final Account assetAccount = this.accountHelper.createAssetAccount();
+        final Account incomeAccount = this.accountHelper.createIncomeAccount();
+        final Account expenseAccount = 
this.accountHelper.createExpenseAccount();
+        final Account liabilityAccount = 
this.accountHelper.createLiabilityAccount();
+
+        final Integer savingsProductID = 
createSavingsProductWithAccrualAccountingWithOutOverdraftAllowed(MINIMUM_OPENING_BALANCE,
+                assetAccount, incomeAccount, expenseAccount, liabilityAccount);
+        final GetSavingsProductsProductIdResponse savingsProductsResponse = 
SavingsProductHelper.getSavingsProductById(requestSpec,
+                responseSpec, savingsProductID);
+        Assertions.assertNotNull(savingsProductsResponse);
+        
Assertions.assertNotNull(savingsProductsResponse.getAccountingMappings());
+        
Assertions.assertNull(savingsProductsResponse.getAccountingMappings().getInterestReceivableAccount());
+    }
+
+    @Test
+    public void testSavingsProductWithOverdraftCreation_AllowsOverdraft() {
+        // --- ARRANGE ---
+        final Account assetAccount = this.accountHelper.createAssetAccount();
+        final Account incomeAccount = this.accountHelper.createIncomeAccount();
+        final Account expenseAccount = 
this.accountHelper.createExpenseAccount();
+        final Account liabilityAccount = 
this.accountHelper.createLiabilityAccount();
+
+        final Integer savingsProductID = 
createSavingsProductWithAccrualAccountingWithOverdraftAllowed(MINIMUM_OPENING_BALANCE,
+                assetAccount, incomeAccount, expenseAccount, liabilityAccount);
+        final GetSavingsProductsProductIdResponse savingsProductsResponse = 
SavingsProductHelper.getSavingsProductById(requestSpec,
+                responseSpec, savingsProductID);
+        Assertions.assertNotNull(savingsProductsResponse);
+        
Assertions.assertNotNull(savingsProductsResponse.getAccountingMappings());
+        
Assertions.assertNotNull(savingsProductsResponse.getAccountingMappings().getInterestReceivableAccount());

Review Comment:
   Checking whether mapping is null or not is not enough!
   Please make sure you are providing a particular GL account to the interest 
receivable mapping and check whether that particular GL account was set!



-- 
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]

Reply via email to