FINERACT-822 enable BadImport error check

This commit is contained in:
percyashu
2020-06-20 00:01:23 +02:00
committed by Michael Vorburger ⛑️
parent a72c2f4e47
commit cf4acffb01
6 changed files with 13 additions and 16 deletions
+2 -2
View File
@@ -338,7 +338,6 @@ tasks.withType(JavaCompile) {
"SameNameButDifferent", "SameNameButDifferent",
"StringSplitter", "StringSplitter",
"ImmutableEnumChecker", "ImmutableEnumChecker",
"BadImport",
"UnusedMethod", "UnusedMethod",
"ModifiedButNotUsed", "ModifiedButNotUsed",
"TypeParameterUnusedInFormals", "TypeParameterUnusedInFormals",
@@ -379,6 +378,7 @@ tasks.withType(JavaCompile) {
"MixedArrayDimensions", "MixedArrayDimensions",
"PackageLocation", "PackageLocation",
"UseBinds", "UseBinds",
"BadImport",
"IntLongMath", "IntLongMath",
"FloatCast", "FloatCast",
"ReachabilityFenceUsage", "ReachabilityFenceUsage",
@@ -397,6 +397,7 @@ tasks.withType(JavaCompile) {
"PrivateConstructorForNoninstantiableModule", "PrivateConstructorForNoninstantiableModule",
"ClassCanBeStatic", "ClassCanBeStatic",
"ClassNewInstance", "ClassNewInstance",
"UnnecessaryStaticImport",
"UnsafeFinalization", "UnsafeFinalization",
"JodaPlusMinusLong", "JodaPlusMinusLong",
"MutableMethodReturnType", "MutableMethodReturnType",
@@ -419,7 +420,6 @@ tasks.withType(JavaCompile) {
// "MethodCanBeStatic", // "MethodCanBeStatic",
// "Var", // "Var",
// "ConstantField", // "ConstantField",
// "UnnecessaryStaticImport",
// "ConstructorInvokesOverridable", // "ConstructorInvokesOverridable",
// "InjectOnConstructorOfAbstractClass", // "InjectOnConstructorOfAbstractClass",
// "StringSplitter", // "StringSplitter",
@@ -18,10 +18,10 @@
*/ */
package org.apache.fineract.integrationtests.common; package org.apache.fineract.integrationtests.common;
import static io.restassured.path.json.JsonPath.from;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.restassured.path.json.JsonPath;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
import java.util.HashMap; import java.util.HashMap;
@@ -87,7 +87,7 @@ public class CalendarHelper {
final String CLIENT_URL = "/fineract-provider/api/v1/groups/" + generatedGroupId + "?associations=all&" + Utils.TENANT_IDENTIFIER; final String CLIENT_URL = "/fineract-provider/api/v1/groups/" + generatedGroupId + "?associations=all&" + Utils.TENANT_IDENTIFIER;
final String responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL, final String responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL,
"collectionMeetingCalendar"); "collectionMeetingCalendar");
final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id"); final Integer responseCalendarId = JsonPath.from(responseCalendarDetailsinJSON).get("id");
assertEquals(generatedCalendarId, responseCalendarId, "ERROR IN CREATING THE CALENDAR"); assertEquals(generatedCalendarId, responseCalendarId, "ERROR IN CREATING THE CALENDAR");
} }
@@ -19,7 +19,6 @@
package org.apache.fineract.integrationtests.common; package org.apache.fineract.integrationtests.common;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@@ -138,7 +137,7 @@ public class Utils {
if (jsonAttributeToGetBack == null) { if (jsonAttributeToGetBack == null) {
return (T) json; return (T) json;
} }
return (T) from(json).get(jsonAttributeToGetBack); return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
} }
public static String performGetTextResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static String performGetTextResponse(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
@@ -158,28 +157,28 @@ public class Utils {
if (jsonAttributeToGetBack == null) { if (jsonAttributeToGetBack == null) {
return (T) json; return (T) json;
} }
return (T) from(json).get(jsonAttributeToGetBack); return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
} }
public static <T> T performServerPut(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static <T> T performServerPut(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String putURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) { 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) final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when().put(putURL)
.andReturn().asString(); .andReturn().asString();
return (T) from(json).get(jsonAttributeToGetBack); return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
} }
public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String deleteURL, final String jsonAttributeToGetBack) { final String deleteURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().delete(deleteURL).andReturn() final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().delete(deleteURL).andReturn()
.asString(); .asString();
return (T) from(json).get(jsonAttributeToGetBack); return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
} }
public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String deleteURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) { final String deleteURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when() final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when()
.delete(deleteURL).andReturn().asString(); .delete(deleteURL).andReturn().asString();
return (T) (jsonAttributeToGetBack == null ? json : from(json).get(jsonAttributeToGetBack)); return (T) (jsonAttributeToGetBack == null ? json : JsonPath.from(json).get(jsonAttributeToGetBack));
} }
public static String convertDateToURLFormat(final String dateToBeConvert) throws ParseException { public static String convertDateToURLFormat(final String dateToBeConvert) throws ParseException {
@@ -19,11 +19,11 @@
package org.apache.fineract.integrationtests.common.organisation; package org.apache.fineract.integrationtests.common.organisation;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import io.restassured.path.json.JsonPath;
import io.restassured.specification.RequestSpecification; import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification; import io.restassured.specification.ResponseSpecification;
import java.lang.reflect.Type; import java.lang.reflect.Type;
@@ -178,7 +178,7 @@ public class CampaignsHelper {
.asString(); .asString();
Assert.notNull(json, "json"); Assert.notNull(json, "json");
ArrayList<ReportData> reportsList = new ArrayList<>(); ArrayList<ReportData> reportsList = new ArrayList<>();
String reportsString = new Gson().toJson(from(json).get(jsonAttributeToGetBack)); String reportsString = new Gson().toJson(JsonPath.from(json).get(jsonAttributeToGetBack));
Assert.notNull(reportsString, "reportsString"); Assert.notNull(reportsString, "reportsString");
final Gson gson = new Gson(); final Gson gson = new Gson();
final Type typeOfHashMap = new TypeToken<List<ReportData>>() {}.getType(); final Type typeOfHashMap = new TypeToken<List<ReportData>>() {}.getType();
@@ -30,7 +30,6 @@ import org.apache.fineract.infrastructure.gcm.GcmConstants;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistration; import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistration;
import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationRepositoryWrapper; import org.apache.fineract.infrastructure.gcm.domain.DeviceRegistrationRepositoryWrapper;
import org.apache.fineract.infrastructure.gcm.domain.Message; import org.apache.fineract.infrastructure.gcm.domain.Message;
import org.apache.fineract.infrastructure.gcm.domain.Message.Builder;
import org.apache.fineract.infrastructure.gcm.domain.Message.Priority; import org.apache.fineract.infrastructure.gcm.domain.Message.Priority;
import org.apache.fineract.infrastructure.gcm.domain.Notification; import org.apache.fineract.infrastructure.gcm.domain.Notification;
import org.apache.fineract.infrastructure.gcm.domain.NotificationConfigurationData; import org.apache.fineract.infrastructure.gcm.domain.NotificationConfigurationData;
@@ -94,7 +93,7 @@ public class NotificationSenderService {
try { try {
Notification notification = new Notification.Builder(GcmConstants.defaultIcon).title(GcmConstants.title) Notification notification = new Notification.Builder(GcmConstants.defaultIcon).title(GcmConstants.title)
.body(smsMessage.getMessage()).build(); .body(smsMessage.getMessage()).build();
Builder b = new Builder(); Message.Builder b = new Message.Builder();
b.notification(notification); b.notification(notification);
b.dryRun(false); b.dryRun(false);
b.contentAvailable(true); b.contentAvailable(true);
@@ -19,7 +19,6 @@
package org.apache.fineract.common; package org.apache.fineract.common;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assertions.fail;
@@ -75,7 +74,7 @@ public class Utils {
public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, public static <T> T performServerGet(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String getURL, final String jsonAttributeToGetBack) { final String getURL, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString(); final String json = given().spec(requestSpec).expect().spec(responseSpec).log().ifError().when().get(getURL).andReturn().asString();
return (T) from(json).get(jsonAttributeToGetBack); return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
} }
} }