improve StaffImageApiTest (for FINERACT-965 non-regression)

This commit is contained in:
Michael Vorburger
2020-06-02 15:29:45 +01:00
committed by Yemdjih Kaze Nasser
parent 83de217b64
commit 956a84114f
2 changed files with 8 additions and 5 deletions
@@ -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
@@ -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=";
}
}