Sfoglia il codice sorgente

Stay golden Ponyboy

Mitch Taylor 6 anni fa
parent
commit
f87afeabb2

+ 5
- 4
src/main/java/HamletParser.java Vedi File

@@ -16,8 +16,8 @@ public class HamletParser {
16 16
         hamletData = loadFile();
17 17
     }
18 18
 
19
-    private static String loadFile(){
20
-        ClassLoader classLoader = HamletParser.class.getClassLoader();
19
+    public String loadFile(){
20
+        ClassLoader classLoader = getClass().getClassLoader();
21 21
         File file = new File(classLoader.getResource("hamlet.txt").getFile());
22 22
         StringBuilder result = new StringBuilder("");
23 23
         try(Scanner scanner = new Scanner(file)){
@@ -54,7 +54,7 @@ public class HamletParser {
54 54
         return matcher.appendTail(sb).toString();
55 55
     }
56 56
 
57
-    private static void changeEverythingAndPutInFile() throws IOException {
57
+    private void changeEverythingAndPutInFile() throws IOException {
58 58
         String fixedFile = changeHamletToLeon(changeHoratioToTariq(hamletData));
59 59
         FileWriter fileWriter = new FileWriter("src/main/resources/zipcodeHamlet.txt", true);
60 60
         fileWriter.write(fixedFile);
@@ -62,7 +62,8 @@ public class HamletParser {
62 62
     }
63 63
 
64 64
     public static void main(String[] args) throws IOException {
65
-        changeEverythingAndPutInFile();
65
+        HamletParser h = new HamletParser();
66
+        h.changeEverythingAndPutInFile();
66 67
     }
67 68
 
68 69
 }

+ 5383
- 0
src/main/resources/zipcodeHamlet.txt
File diff suppressed because it is too large
Vedi File


+ 6
- 0
src/test/java/HamletParserTest.java Vedi File

@@ -29,4 +29,10 @@ public class HamletParserTest {
29 29
         Assert.assertEquals(expected, actual);
30 30
     }
31 31
 
32
+//    @Test
33
+//    public void testLoadFile() {
34
+//        String expected = ;
35
+//        String actual = hamletParser.loadFile();
36
+//    }
37
+
32 38
 }