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",
"StringSplitter",
"ImmutableEnumChecker",
"BadImport",
"UnusedMethod",
"ModifiedButNotUsed",
"TypeParameterUnusedInFormals",
@@ -379,6 +378,7 @@ tasks.withType(JavaCompile) {
"MixedArrayDimensions",
"PackageLocation",
"UseBinds",
"BadImport",
"IntLongMath",
"FloatCast",
"ReachabilityFenceUsage",
@@ -397,6 +397,7 @@ tasks.withType(JavaCompile) {
"PrivateConstructorForNoninstantiableModule",
"ClassCanBeStatic",
"ClassNewInstance",
"UnnecessaryStaticImport",
"UnsafeFinalization",
"JodaPlusMinusLong",
"MutableMethodReturnType",
@@ -419,7 +420,6 @@ tasks.withType(JavaCompile) {
// "MethodCanBeStatic",
// "Var",
// "ConstantField",
// "UnnecessaryStaticImport",
// "ConstructorInvokesOverridable",
// "InjectOnConstructorOfAbstractClass",
// "StringSplitter",
@@ -18,10 +18,10 @@
*/
package org.apache.fineract.integrationtests.common;
import static io.restassured.path.json.JsonPath.from;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import io.restassured.path.json.JsonPath;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
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 responseCalendarDetailsinJSON = Utils.performServerGet(requestSpec, responseSpec, CLIENT_URL,
"collectionMeetingCalendar");
final Integer responseCalendarId = from(responseCalendarDetailsinJSON).get("id");
final Integer responseCalendarId = JsonPath.from(responseCalendarDetailsinJSON).get("id");
assertEquals(generatedCalendarId, responseCalendarId, "ERROR IN CREATING THE CALENDAR");
}
@@ -19,7 +19,6 @@
package org.apache.fineract.integrationtests.common;
import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.fail;
@@ -138,7 +137,7 @@ public class Utils {
if (jsonAttributeToGetBack == null) {
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,
@@ -158,28 +157,28 @@ public class Utils {
if (jsonAttributeToGetBack == null) {
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,
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);
return (T) JsonPath.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);
return (T) JsonPath.from(json).get(jsonAttributeToGetBack);
}
public static <T> T performServerDelete(final RequestSpecification requestSpec, final ResponseSpecification responseSpec,
final String deleteURL, final String jsonBodyToSend, final String jsonAttributeToGetBack) {
final String json = given().spec(requestSpec).body(jsonBodyToSend).expect().spec(responseSpec).log().ifError().when()
.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 {
@@ -19,11 +19,11 @@
package org.apache.fineract.integrationtests.common.organisation;
import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.junit.jupiter.api.Assertions.assertEquals;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import io.restassured.path.json.JsonPath;
import io.restassured.specification.RequestSpecification;
import io.restassured.specification.ResponseSpecification;
import java.lang.reflect.Type;
@@ -178,7 +178,7 @@ public class CampaignsHelper {
.asString();
Assert.notNull(json, "json");
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");
final Gson gson = new Gson();
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.DeviceRegistrationRepositoryWrapper;
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.Notification;
import org.apache.fineract.infrastructure.gcm.domain.NotificationConfigurationData;
@@ -94,7 +93,7 @@ public class NotificationSenderService {
try {
Notification notification = new Notification.Builder(GcmConstants.defaultIcon).title(GcmConstants.title)
.body(smsMessage.getMessage()).build();
Builder b = new Builder();
Message.Builder b = new Message.Builder();
b.notification(notification);
b.dryRun(false);
b.contentAvailable(true);
@@ -19,7 +19,6 @@
package org.apache.fineract.common;
import static io.restassured.RestAssured.given;
import static io.restassured.path.json.JsonPath.from;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
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,
final String getURL, final String jsonAttributeToGetBack) {
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);
}
}