fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [fineract] 04/04: improve StaffImageApiTest (for FINERACT-965 non-regression)
Date Tue, 02 Jun 2020 14:30:00 GMT
This is an automated email from the ASF dual-hosted git repository.

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

commit 956a84114fe52c51591cfa37b8c331f95a6ffcaa
Author: Michael Vorburger <mike@vorburger.ch>
AuthorDate: Mon Jun 1 14:01:13 2020 +0200

    improve StaffImageApiTest (for FINERACT-965 non-regression)
---
 .../apache/fineract/integrationtests/StaffImageApiTest.java    |  3 +++
 .../apache/fineract/integrationtests/common/ImageHelper.java   | 10 +++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java
index 8707a39..d201031 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/StaffImageApiTest.java
@@ -18,6 +18,7 @@
  */
 package org.apache.fineract.integrationtests;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
 import io.restassured.builder.RequestSpecBuilder;
@@ -58,6 +59,7 @@ public class StaffImageApiTest {
         assertNotNull("Image id should not be null", imageId);
         String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec,
staffId);
         assertNotNull("Image id should not be null", imageAsText);
+        assertEquals(ImageHelper.generateImageAsText(), imageAsText);
     }
 
     @Test
@@ -67,6 +69,7 @@ public class StaffImageApiTest {
         assertNotNull("Image id should not be null", imageId);
         byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec,
staffId);
         assertNotNull("Image content should not be null", imageAsBytes);
+        assertEquals(251, imageAsBytes.length);
     }
 
     @Test
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ImageHelper.java
b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ImageHelper.java
index 42d523c..45f8592 100644
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ImageHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/ImageHelper.java
@@ -65,10 +65,10 @@ public class ImageHelper {
         return Utils.performServerDelete(requestSpec, responseSpec, URL, "resourceId");
     }
 
-    private static String generateImageAsText() {
-        return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ\n"
-                + "bWFnZVJlYWR5ccllPAAAAJ1JREFUeNpi+P//PwMIA4E9EG8E4idQDGLbw+WhiiqA+D8OXAFVAzbp\n"
-                + "DxBvB2JLIGaGYkuoGEjOhhFIHAbij0BdPgxYACMj42ogJQpifwBiXSDeC8JIbt4LxSC5DyxQjTeB\n"
-                + "+BeaYb+Q5EBOAVutCzMJHUNNPADzzDokiYdAfAmJvwLkGeTgWQfyKZICS6hYBTwc0QL8ORSjBDhA\n"
+ "gAEAOg13B6R/SAgAAAAASUVORK5CYII=";
+    public static String generateImageAsText() {
+        return "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ\r\n"
+                + "bWFnZVJlYWR5ccllPAAAAJ1JREFUeNpi+P//PwMIA4E9EG8E4idQDGLbw+WhiiqA+D8OXAFVAzbp\r\n"
+                + "DxBvB2JLIGaGYkuoGEjOhhFIHAbij0BdPgxYACMj42ogJQpifwBiXSDeC8JIbt4LxSC5DyxQjTeB\r\n"
+                + "+BeaYb+Q5EBOAVutCzMJHUNNPADzzDokiYdAfAmJvwLkGeTgWQfyKZICS6hYBTwc0QL8ORSjBDhA\r\n"
+ "gAEAOg13B6R/SAgAAAAASUVORK5CYII=";
     }
 }


Mime
View raw message