mm-saiful6854 commented on code in PR #6088:
URL: https://github.com/apache/fineract/pull/6088#discussion_r3524869944


##########
fineract-accounting/src/test/java/org/apache/fineract/accounting/glaccount/service/GLAccountWritePlatformServiceJpaRepositoryImplTest.java:
##########
@@ -0,0 +1,86 @@
+/**
+ * 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.glaccount.service;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Optional;
+import org.apache.fineract.accounting.glaccount.domain.GLAccount;
+import org.apache.fineract.accounting.glaccount.domain.GLAccountRepository;
+import 
org.apache.fineract.accounting.journalentry.domain.JournalEntryRepository;
+import 
org.apache.fineract.accounting.producttoaccountmapping.domain.ProductToGLAccountMappingRepository;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.springframework.data.jpa.domain.Specification;
+
+@ExtendWith(MockitoExtension.class)
+class GLAccountWritePlatformServiceJpaRepositoryImplTest {
+
+    @Mock
+    private GLAccountRepository glAccountRepository;
+
+    @Mock
+    private JournalEntryRepository glJournalEntryRepository;
+
+    @Mock
+    private ProductToGLAccountMappingRepository 
productToGLAccountMappingRepository;
+
+    @InjectMocks
+    private GLAccountWritePlatformServiceJpaRepositoryImpl 
glAccountWritePlatformService;
+
+    private GLAccount glAccount;
+    private static final Long GL_ACCOUNT_ID = 123L;
+
+    @BeforeEach
+    void setUp() {
+        glAccount = new GLAccount();
+        glAccount.setId(GL_ACCOUNT_ID);
+        glAccount.setName("Test Account");
+        glAccount.setGlCode("TEST001");
+    }
+
+    /**
+     * Verify that a GL account can be deleted when it has no dependencies.
+     */
+    @Test
+    void testDeleteGLAccountSuccessWithNoDependencies() {
+        // Given: A GL account with no children, no journal entries, and no 
product mappings
+        
when(glAccountRepository.findById(GL_ACCOUNT_ID)).thenReturn(Optional.of(glAccount));
+        
when(glJournalEntryRepository.exists(any(Specification.class))).thenReturn(false);

Review Comment:
   sure. thank you for giving me feedback. Let me handling compiler warnings 
asap.



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