You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/02/02 10:37:03 UTC

[fineract] branch develop updated: FINERACT-775 Clean up Util

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

vorburger 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 aadc2a0  FINERACT-775 Clean up Util
aadc2a0 is described below

commit aadc2a006ccb5f655a74b50cf449f55a51f50575
Author: percyashu <pe...@gmail.com>
AuthorDate: Sat Feb 1 17:58:49 2020 +0100

    FINERACT-775 Clean up Util
---
 .../java/org/apache/fineract/common/Utils.java     | 58 +---------------------
 1 file changed, 2 insertions(+), 56 deletions(-)

diff --git a/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java b/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java
index e9bc6df..4ab096d 100644
--- a/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java
+++ b/fineract-provider/src/test/java/org/apache/fineract/common/Utils.java
@@ -28,13 +28,11 @@ import com.jayway.restassured.RestAssured;
 import com.jayway.restassured.path.json.JsonPath;
 import com.jayway.restassured.specification.RequestSpecification;
 import com.jayway.restassured.specification.ResponseSpecification;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Locale;
-import java.util.Random;
 import org.apache.commons.lang.StringUtils;
 import org.apache.http.conn.HttpHostConnectException;
 
+
+
 /**
  * Util for RestAssured tests. This class here in src/test is copy/pasted :(
  * from and identical to the one in src/integrationTest; please keep it in sync.
@@ -77,56 +75,4 @@ public class Utils {
         return (T) from(json).get(jsonAttributeToGetBack);
     }
 
-    public static <T> T performServerPost(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
-            final String postURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
-        final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().post(postURL)
-                .andReturn().asString();
-        if (jsonAttributeToGetBack == null) { return (T) json; }
-        return (T) from(json).get(jsonAttributeToGetBack);
-    }
-
-    public static <T> T performServerPut(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
-            final String putURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
-        final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().put(putURL)
-                .andReturn().asString();
-        return (T) from(json).get(jsonAttributeToGetBack);
-    }
-
-    public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
-            final String deleteURL, final String jsonAttributeToGetBack) {
-        final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().delete(deleteURL).andReturn()
-                .asString();
-        return (T) from(json).get(jsonAttributeToGetBack);
-    }
-
-    public static String convertDateToURLFormat(String dateToBeConvert) {
-        SimpleDateFormat oldFormat = new SimpleDateFormat("dd MMMMMM yyyy", Locale.US);
-        SimpleDateFormat newFormat = new SimpleDateFormat("yyyy-MM-dd");
-        String reformattedStr = "";
-        try {
-            reformattedStr = newFormat.format(oldFormat.parse(dateToBeConvert));
-        } catch (final ParseException e) {
-            e.printStackTrace();
-        }
-        return reformattedStr;
-    }
-
-    public static String randomStringGenerator(final String prefix, final int len, final String sourceSetString) {
-        final int lengthOfSource = sourceSetString.length();
-        final Random rnd = new Random();
-        final StringBuilder sb = new StringBuilder(len);
-        for (int i = 0; i < len; i++) {
-            sb.append((sourceSetString).charAt(rnd.nextInt(lengthOfSource)));
-        }
-        return (prefix + (sb.toString()));
-    }
-
-    public static String randomStringGenerator(final String prefix, final int len) {
-        return randomStringGenerator(prefix, len, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
-    }
-
-    public static String randomNameGenerator(final String prefix, final int lenOfRandomSuffix) {
-        return randomStringGenerator(prefix, lenOfRandomSuffix);
-    }
-
 }