From 83de217b64226208a85ba25e19f27c21a502ce1a Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 1 Jun 2020 13:52:23 +0200 Subject: [PATCH] minor clean-up in StaffImageApiTest (re. FINERACT-965) --- .../integrationtests/StaffImageApiTest.java | 37 ++++++------------- 1 file changed, 11 insertions(+), 26 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 458201097..8707a3977 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,8 @@ */ package org.apache.fineract.integrationtests; +import static org.junit.Assert.assertNotNull; + import io.restassured.builder.RequestSpecBuilder; import io.restassured.builder.ResponseSpecBuilder; import io.restassured.http.ContentType; @@ -25,10 +27,7 @@ import io.restassured.specification.RequestSpecification; import io.restassured.specification.ResponseSpecification; import org.apache.fineract.integrationtests.common.ImageHelper; import org.apache.fineract.integrationtests.common.Utils; -import org.apache.fineract.integrationtests.common.accounting.AccountHelper; -import org.apache.fineract.integrationtests.common.loans.LoanTransactionHelper; import org.apache.fineract.integrationtests.common.organisation.StaffHelper; -import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -36,8 +35,6 @@ public class StaffImageApiTest { private RequestSpecification requestSpec; private ResponseSpecification responseSpec; - private LoanTransactionHelper loanTransactionHelper; - private AccountHelper accountHelper; @Before public void setup() { @@ -45,60 +42,48 @@ public class StaffImageApiTest { this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build(); this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey()); this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build(); - this.loanTransactionHelper = new LoanTransactionHelper(this.requestSpec, this.responseSpec); - this.accountHelper = new AccountHelper(this.requestSpec, this.responseSpec); - } @Test public void createStaffImage() { - Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); - + assertNotNull("Image id should not be null", imageId); } @Test public void getStaffImage(){ Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); + assertNotNull("Image id should not be null", imageId); String imageAsText = ImageHelper.getStaffImageAsText(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageAsText); + assertNotNull("Image id should not be null", imageAsText); } @Test public void getStaffImageAsBinary(){ Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); + assertNotNull("Image id should not be null", imageId); byte[] imageAsBytes = ImageHelper.getStaffImageAsBinary(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image content should not be null", imageAsBytes); + assertNotNull("Image content should not be null", imageAsBytes); } @Test public void updateImage() { - Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); + assertNotNull("Image id should not be null", imageId); imageId = ImageHelper.updateImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); - + assertNotNull("Image id should not be null", imageId); } @Test public void deleteStaffImage() { - Integer staffId = StaffHelper.createStaff(this.requestSpec, this.responseSpec); Integer imageId = ImageHelper.createImageForStaff(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); + assertNotNull("Image id should not be null", imageId); imageId = ImageHelper.deleteStaffImage(this.requestSpec, this.responseSpec, staffId); - Assert.assertNotNull("Image id should not be null", imageId); - + assertNotNull("Image id should not be null", imageId); } - - - }