Просмотр исходного кода

remove unnecessary variables in the method call and directly use the constant path variables

Patrick Thiel 4 лет назад
Родитель
Сommit
a55197f2e6

+ 3 - 4
jplag.endToEndTesting/src/main/java/de/jplag/endToEndTesting/helper/JPlagTestSuiteHelper.java

@@ -42,8 +42,7 @@ public class JPlagTestSuiteHelper {
 		this.languageOption = languageOption;
 		this.languageOption = languageOption;
 		this.resourceNames = new File(Constant.BASE_PATH_TO_JAVA_RESOURCES_SORTALGO.toString()).list();
 		this.resourceNames = new File(Constant.BASE_PATH_TO_JAVA_RESOURCES_SORTALGO.toString()).list();
 
 
-		this.resultModel = JsonHelper
-				.getResultModelFromPath(Constant.BASE_PATH_TO_JAVA_RESULT_JSON.toAbsolutePath().toString());
+		this.resultModel = JsonHelper.getResultModelFromPath();
 		logger.info(String.format("temp path at [%s]", Constant.TEMPORARY_SUBMISSION_DIRECTORY_NAME));
 		logger.info(String.format("temp path at [%s]", Constant.TEMPORARY_SUBMISSION_DIRECTORY_NAME));
 	}
 	}
 
 
@@ -91,8 +90,8 @@ public class JPlagTestSuiteHelper {
 		// Copy the resources data to the temporary path
 		// Copy the resources data to the temporary path
 		for (int counter = 0; counter < classNames.length; counter++) {
 		for (int counter = 0; counter < classNames.length; counter++) {
 			Path originalPath = Path.of(Constant.BASE_PATH_TO_JAVA_RESOURCES_SORTALGO.toString(), classNames[counter]);
 			Path originalPath = Path.of(Constant.BASE_PATH_TO_JAVA_RESOURCES_SORTALGO.toString(), classNames[counter]);
-			Path copiePath = Path.of(Constant.TEMPORARY_SUBMISSION_DIRECTORY_NAME, Constant.TEMPORARY_DIRECTORY_NAME + (counter + 1),
-					classNames[counter]);
+			Path copiePath = Path.of(Constant.TEMPORARY_SUBMISSION_DIRECTORY_NAME,
+					Constant.TEMPORARY_DIRECTORY_NAME + (counter + 1), classNames[counter]);
 
 
 			File directory = new File(copiePath.toString());
 			File directory = new File(copiePath.toString());
 			if (!directory.exists()) {
 			if (!directory.exists()) {

+ 4 - 2
jplag.endToEndTesting/src/main/java/de/jplag/endToEndTesting/helper/JsonHelper.java

@@ -9,6 +9,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.JsonMappingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 
 
+import de.jplag.endToEndTesting.constants.Constant;
 import model.ResultJsonModel;
 import model.ResultJsonModel;
 
 
 public final class JsonHelper {
 public final class JsonHelper {
@@ -26,8 +27,9 @@ public final class JsonHelper {
 	 * @throws JsonProcessingException
 	 * @throws JsonProcessingException
 	 * @throws Exception
 	 * @throws Exception
 	 */
 	 */
-	public static List<ResultJsonModel> getResultModelFromPath(String pathToJsonFile)
+	public static List<ResultJsonModel> getResultModelFromPath()
 			throws JsonMappingException, JsonProcessingException, Exception {
 			throws JsonMappingException, JsonProcessingException, Exception {
-		return Arrays.asList(new ObjectMapper().readValue(Paths.get(pathToJsonFile).toFile(), ResultJsonModel[].class));
+		return Arrays.asList(
+				new ObjectMapper().readValue(Constant.BASE_PATH_TO_JAVA_RESULT_JSON.toFile(), ResultJsonModel[].class));
 	}
 	}
 }
 }