You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by aw...@apache.org on 2020/01/14 07:38:04 UTC

[fineract] branch develop updated: clean up GLAccountBuilder, following SpotBugs (FINERACT-702)

This is an automated email from the ASF dual-hosted git repository.

awasum pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git


The following commit(s) were added to refs/heads/develop by this push:
     new a5c60b0  clean up GLAccountBuilder, following SpotBugs (FINERACT-702)
     new eee163a  Merge pull request #685 from vorburger/spotbugs-extra-GLAccountBuilder
a5c60b0 is described below

commit a5c60b06e59314dc701a6f62c8aa45d272eddc0f
Author: Michael Vorburger <mi...@vorburger.ch>
AuthorDate: Sat Jan 11 00:02:11 2020 +0100

    clean up GLAccountBuilder, following SpotBugs (FINERACT-702)
    
    SpotBugs didn't like the original version, and the initial changes made
    for SpotBugs satisfied SpotBugs, but the class was still pretty weird.
    This change makes it follow the regular standard builder pattern.
---
 .../common/accounting/GLAccountBuilder.java        | 47 +++++++++++-----------
 1 file changed, 24 insertions(+), 23 deletions(-)

diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
index 348c913..0e8467a 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/accounting/GLAccountBuilder.java
@@ -26,69 +26,70 @@ import java.util.HashMap;
 
 public class GLAccountBuilder {
 
-    public final String ASSET_ACCOUNT = "1";
-    public final String LIABILITY_ACCOUNT = "2";
-    public final String EQUITY_ACCOUNT = "3";
-    public final String INCOME_ACCOUNT = "4";
-    public final String EXPENSE_ACCOUNT = "5";
+    public static final String ASSET_ACCOUNT = "1";
+    public static final String LIABILITY_ACCOUNT = "2";
+    public static final String EQUITY_ACCOUNT = "3";
+    public static final String INCOME_ACCOUNT = "4";
+    public static final String EXPENSE_ACCOUNT = "5";
 
-    private final String ACCOUNT_USAGE_DETAIL = "1";
-    private final String ACCOUNT_USAGE_HEADER = "2";
-    private final String MANUAL_ENTRIES_ALLOW = "true";
-    private final String MANUAL_ENTRIES_NOT_ALLOW = "false";
+    private static final String ACCOUNT_USAGE_DETAIL = "1";
+    private static final String ACCOUNT_USAGE_HEADER = "2";
+    private static final String MANUAL_ENTRIES_ALLOW = "true";
+    private static final String MANUAL_ENTRIES_NOT_ALLOW = "false";
+
+    private static final String DESCRIPTION = "DEFAULT_DESCRIPTION";
 
     private String name = Utils.randomStringGenerator("ACCOUNT_NAME_", 5);
 
-    private String GLCode = "";
+    private String glCode = "";
     private String accountType = "";
     private String accountUsage = ACCOUNT_USAGE_DETAIL;
     private String manualEntriesAllowed = MANUAL_ENTRIES_ALLOW;
-    private String description = "DEFAULT_DESCRIPTION";
 
     public String build() {
         final HashMap<String, String> map = new HashMap<>();
         map.put("name", name);
-        map.put("glCode", GLCode);
+        map.put("glCode", glCode);
         map.put("manualEntriesAllowed", manualEntriesAllowed);
         map.put("type", accountType);
         map.put("usage", accountUsage);
-        map.put("description", description);
+        map.put("description", DESCRIPTION);
         return new Gson().toJson(map);
     }
 
     public GLAccountBuilder withAccountTypeAsAsset() {
         accountType = ASSET_ACCOUNT;
-        GLCode = Utils.randomStringGenerator("ASSET_", 2);
+        glCode = Utils.randomStringGenerator("ASSET_", 2);
         // Add unique timestamp to avoid random collisions
-        GLCode += Calendar.getInstance().getTimeInMillis() + "";
+        glCode += Calendar.getInstance().getTimeInMillis() + ""; 
         return this;
     }
 
     public GLAccountBuilder withAccountTypeAsLiability() {
         accountType = LIABILITY_ACCOUNT;
-        GLCode = Utils.randomStringGenerator("LIABILITY_", 2);
-        GLCode += Calendar.getInstance().getTimeInMillis() + "";
+        glCode = Utils.randomStringGenerator("LIABILITY_", 2);
+        glCode += Calendar.getInstance().getTimeInMillis() + "";
         return this;
     }
 
     public GLAccountBuilder withAccountTypeAsAsEquity() {
         accountType = EQUITY_ACCOUNT;
-        GLCode = Utils.randomStringGenerator("EQUITY_", 2);
-        GLCode += Calendar.getInstance().getTimeInMillis() + "";
+        glCode = Utils.randomStringGenerator("EQUITY_", 2);
+        glCode += Calendar.getInstance().getTimeInMillis() + "";
         return this;
     }
 
     public GLAccountBuilder withAccountTypeAsIncome() {
         accountType = INCOME_ACCOUNT;
-        GLCode = Utils.randomStringGenerator("INCOME_", 2);
-        GLCode += Calendar.getInstance().getTimeInMillis() + "";
+        glCode = Utils.randomStringGenerator("INCOME_", 2);
+        glCode += Calendar.getInstance().getTimeInMillis() + "";
         return this;
     }
 
     public GLAccountBuilder withAccountTypeAsExpense() {
         accountType = EXPENSE_ACCOUNT;
-        GLCode = Utils.randomStringGenerator("EXPENSE_", 2);
-        GLCode += Calendar.getInstance().getTimeInMillis() + "";
+        glCode = Utils.randomStringGenerator("EXPENSE_", 2);
+        glCode += Calendar.getInstance().getTimeInMillis() + "";
         return this;
     }