From cf6323371155aeb93f78fad9e88f2821e529f839 Mon Sep 17 00:00:00 2001 From: Satish Kumar Date: Wed, 20 May 2026 19:34:39 +0530 Subject: [PATCH] FINERACT-1122: Fix deposit interest rate chart NPE --- .../DepositAccountInterestRateChartData.java | 4 +++ ...positAccountInterestRateChartDataTest.java | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 fineract-savings/src/test/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartDataTest.java diff --git a/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartData.java b/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartData.java index 46adf4221e5..b2ca4c83ad6 100644 --- a/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartData.java +++ b/fineract-savings/src/main/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartData.java @@ -70,6 +70,10 @@ public static DepositAccountInterestRateChartData instance(Long id, String name, } public static DepositAccountInterestRateChartData from(InterestRateChartData productChartData) { + if (productChartData == null) { + return null; + } + final Long id = null; final Long accountId = null; final String accountNumber = null; diff --git a/fineract-savings/src/test/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartDataTest.java b/fineract-savings/src/test/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartDataTest.java new file mode 100644 index 00000000000..5ae49d2340c --- /dev/null +++ b/fineract-savings/src/test/java/org/apache/fineract/portfolio/savings/data/DepositAccountInterestRateChartDataTest.java @@ -0,0 +1,31 @@ +/** + * 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.savings.data; + +import static org.junit.jupiter.api.Assertions.assertNull; + +import org.junit.jupiter.api.Test; + +class DepositAccountInterestRateChartDataTest { + + @Test + void fromShouldReturnNullWhenProductChartDataIsNull() { + assertNull(DepositAccountInterestRateChartData.from(null)); + } +}