Skip to content

Commit 8137e3c

Browse files
committed
fix
1 parent 3870df3 commit 8137e3c

File tree

8 files changed

+12
-15
lines changed

8 files changed

+12
-15
lines changed

app/src/main/java/hexlet/code/App.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import java.io.IOException;
99
import java.util.concurrent.Callable;
1010

11-
12-
1311
@Command(name = "gendiff", mixinStandardHelpOptions = true, version = "gendiff 0.9",
1412
description = "Compares two configuration files and shows a difference.")
1513
public final class App implements Callable<Integer> {

app/src/main/java/hexlet/code/Differ.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class Differ {
1414
public static final String DEFAULT_FORMAT = "stylish";
1515

1616
public static String generate(String filePath1, String filePath2, String format) throws IOException {
17-
var normalizedPath1 = FileManager.normaolizePath(Path.of(filePath1));
18-
var normalizedPath2 = FileManager.normaolizePath(Path.of(filePath2));
17+
var normalizedPath1 = FileManager.normalizePath(Path.of(filePath1));
18+
var normalizedPath2 = FileManager.normalizePath(Path.of(filePath2));
1919

2020

2121
if (Files.notExists(normalizedPath1) || Files.notExists(normalizedPath2)) {

app/src/main/java/hexlet/code/FileManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
import java.nio.file.Path;
44

55
public class FileManager {
6-
7-
public static Path normaolizePath(Path noNormPath) throws IllegalArgumentException {
6+
public static Path normalizePath(Path noNormPath) throws IllegalArgumentException {
87

98
if (noNormPath == null) {
109
throw new IllegalArgumentException("The file path cannot be empty!");

app/src/main/java/hexlet/code/Formatter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ public static String generateFormatString(String format, Map<String, List<Object
1717

1818
switch (normalizeFormat) {
1919
case "plain":
20-
result += Plain.plain(differenceMap);
20+
result += Plain.formatPlain(differenceMap);
2121
break;
2222
case "stylish":
23-
result += Stylish.stylish(differenceMap);
23+
result += Stylish.formatStylish(differenceMap);
2424
break;
2525
case "json":
26-
result += Json.json(differenceMap);
26+
result += Json.formatJson(differenceMap);
2727
break;
2828
default:
2929
throw new IllegalArgumentException("Не найден формат");

app/src/main/java/hexlet/code/formatters/Json.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.Map;
88

99
public class Json {
10-
public static String json(Map<String, List<Object>> differenceMap) throws JsonProcessingException {
10+
public static String formatJson(Map<String, List<Object>> differenceMap) throws JsonProcessingException {
1111
ObjectMapper objectMapper = new ObjectMapper();
1212
var result = objectMapper.writeValueAsString(differenceMap);
1313
return result.trim();

app/src/main/java/hexlet/code/formatters/Plain.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class Plain {
1010

11-
public static String getPrintString(Object value) {
11+
private static String getPrintString(Object value) {
1212

1313
String result = value.toString();
1414

@@ -26,7 +26,7 @@ public static String getPrintString(Object value) {
2626
return result;
2727
}
2828

29-
public static String plain(Map<String, List<Object>> differenceMap) {
29+
public static String formatPlain(Map<String, List<Object>> differenceMap) {
3030
StringBuilder result = new StringBuilder();
3131
differenceMap.forEach((key, value) -> {
3232
String addString = "Property '" + key + "' was ";

app/src/main/java/hexlet/code/formatters/Stylish.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import java.util.Map;
77

88
public class Stylish {
9-
public static String stylish(Map<String, List<Object>> differenceMap) {
9+
public static String formatStylish(Map<String, List<Object>> differenceMap) {
1010
StringBuilder result = new StringBuilder("{\n");
1111
differenceMap.forEach((key, value) -> {
1212
String addedString = "";

app/src/test/java/source/TestFIleManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ public class TestFIleManager {
1313
public void testNormalizePath() {
1414
var notNormalizePath = Paths.get("./src/test/java/resources");
1515
var normalizeAbsolutePath = Paths.get("src/test/java/resources").toAbsolutePath();
16-
assertEquals(FileManager.normaolizePath(notNormalizePath), normalizeAbsolutePath);
16+
assertEquals(FileManager.normalizePath(notNormalizePath), normalizeAbsolutePath);
1717
}
1818

1919
@Test
2020
public void testNull() {
2121
var thrownFirstArg = assertThrows(IllegalArgumentException.class, () -> {
22-
FileManager.normaolizePath(null);
22+
FileManager.normalizePath(null);
2323
});
2424
assertEquals("The file path cannot be empty!", thrownFirstArg.getMessage());
2525
}

0 commit comments

Comments
 (0)