Skip to content

Commit

Permalink
Merge pull request #128 from DevFactory/release/general-code-quality-…
Browse files Browse the repository at this point in the history
…fix-1

General code quality fix-1
  • Loading branch information
anujgandharv committed May 25, 2016
2 parents 0565109 + c83f996 commit fca758e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
Expand Up @@ -67,7 +67,7 @@ public static EasyAssignments allUnassigned(Method testMethod, TestClass testCla
}

public boolean isComplete() {
return fUnassigned.size() == 0;
return fUnassigned.isEmpty();
}

public EasyParamSignature nextUnassigned() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/easetech/easytest/io/UrlResource.java
Expand Up @@ -78,7 +78,7 @@ public boolean exists() {
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestMethod("HEAD");
return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
return con.getResponseCode() == HttpURLConnection.HTTP_OK;
} catch (Exception e) {
Log.debug("Exception occured while trying to find whether the resource exists or not ", e);
return false;
Expand Down
Expand Up @@ -342,7 +342,7 @@ private void writeDataToCSV(Resource resource, Map<String, List<Map<String, Obje
String[] finalValues = new String[dataKeys.length];
finalValues[0] = EMPTY_STRING;
for(int i=1 ;i<dataKeys.length ; i++){
finalValues[i] = (currentRowData.get(dataKeys[i]) == null ? "null" :currentRowData.get(dataKeys[i]).toString());
finalValues[i] = currentRowData.get(dataKeys[i]) == null ? "null" :currentRowData.get(dataKeys[i]).toString();
}
writeOutputData(currentRowData, finalValues, dataKeys);
writableData.add(finalValues);
Expand Down
Expand Up @@ -86,7 +86,7 @@ public void setEndInNano(long endInNano) {
* @return Time difference in nano seconds
*/
public long getNanoDifference() {
return (this.endInNano - this.startInNano);
return this.endInNano - this.startInNano;
}

/**
Expand Down
Expand Up @@ -322,7 +322,7 @@ protected void validateInstanceMethods(List<Throwable> errors) {
validatePublicVoidNoArgMethods(Before.class, false, errors);
validateTestMethods(errors);

if (getTestClass().getAnnotatedMethods(Test.class).size() == 0)
if (getTestClass().getAnnotatedMethods(Test.class).isEmpty())
errors.add(new Exception("No runnable methods"));
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/easetech/easytest/util/CommonUtils.java
Expand Up @@ -341,7 +341,7 @@ public static String deleteAny(String inString, String charsToDelete) {
* @see #hasText(String)
*/
public static boolean hasLength(String str) {
return (str != null && str.length() > 0);
return str != null && str.length() > 0;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/easetech/easytest/util/GeneralUtil.java
Expand Up @@ -77,8 +77,8 @@ public static Double getRounded(double valueToRound, int numberOfDecimalPlaces)
* @return String value or null if it is not set in the data.
*/
public static String getStringValue(String paramName, Map<String, Object> data) {
return (data.get(paramName) != null && !data.get(paramName).equals("null") ? data.get(paramName).toString()
: null);
return data.get(paramName) != null && !data.get(paramName).equals("null") ? data.get(paramName).toString()
: null;

}

Expand Down Expand Up @@ -318,7 +318,7 @@ public static Long convertToLong(Object object) {
Long longvalue = null;
if (object != null) {
if (object instanceof Long) {
longvalue = ((Long) object).longValue();
longvalue = (Long) object;
} else if (object instanceof Integer) {
longvalue = ((Integer) object).longValue();
} else if (object instanceof Double) {
Expand Down Expand Up @@ -348,7 +348,7 @@ public static Double convertToDouble(Object object) {
} else if (object instanceof Integer) {
doublevalue = ((Integer) object).doubleValue();
} else if (object instanceof Double) {
doublevalue = ((Double) object).doubleValue();
doublevalue = (Double) object;
} else if (object instanceof String && !"".equals((String)object)) {
doublevalue = Double.valueOf((String) object);
}
Expand Down

0 comments on commit fca758e

Please sign in to comment.