Browse Source

removed ignored files; updated file.txt location

Leon 6 years ago
parent
commit
9ca7fc1363

+ 2
- 1
.gitignore View File

3
 .classpath
3
 .classpath
4
 #.project
4
 #.project
5
 .settings
5
 .settings
6
-.idea
6
+.idea
7
+*.iml

+ 0
- 0
file.txt View File


+ 0
- 16
readandwrite.iml View File

1
-<?xml version="1.0" encoding="UTF-8"?>
2
-<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
3
-  <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
4
-    <output url="file://$MODULE_DIR$/target/classes" />
5
-    <output-test url="file://$MODULE_DIR$/target/test-classes" />
6
-    <content url="file://$MODULE_DIR$">
7
-      <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
8
-      <sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
9
-      <excludeFolder url="file://$MODULE_DIR$/target" />
10
-    </content>
11
-    <orderEntry type="inheritedJdk" />
12
-    <orderEntry type="sourceFolder" forTests="false" />
13
-    <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
14
-    <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
15
-  </component>
16
-</module>

+ 3
- 3
src/test/java/rocks/zipcode/alphadocument/AlphaDocumentWriteTest.java View File

15
     @Test(expected = IllegalArgumentException.class)
15
     @Test(expected = IllegalArgumentException.class)
16
     public void writeNumericValuesToFile() throws IOException {
16
     public void writeNumericValuesToFile() throws IOException {
17
         // given
17
         // given
18
-        String fileName = "file.txt";
18
+        String fileName = "target/file.txt";
19
         String contentToBeWritten = "123";
19
         String contentToBeWritten = "123";
20
         Document documentWriter = new AlphaCharDocument(fileName);
20
         Document documentWriter = new AlphaCharDocument(fileName);
21
 
21
 
26
     @Test(expected = IllegalArgumentException.class)
26
     @Test(expected = IllegalArgumentException.class)
27
     public void writeSpecialCharacter() throws IOException {
27
     public void writeSpecialCharacter() throws IOException {
28
         // given
28
         // given
29
-        String fileName = "file.txt";
29
+        String fileName = "target/file.txt";
30
         String contentToBeWritten = "()";
30
         String contentToBeWritten = "()";
31
         Document documentWriter = new AlphaCharDocument(fileName);
31
         Document documentWriter = new AlphaCharDocument(fileName);
32
 
32
 
38
     @Test
38
     @Test
39
     public void writeAlphaValuesTest() throws IOException {
39
     public void writeAlphaValuesTest() throws IOException {
40
         // given
40
         // given
41
-        String fileName = "file.txt";
41
+        String fileName = "target/file.txt";
42
         String expected = "The quick brown foxy";
42
         String expected = "The quick brown foxy";
43
         Document documentWriter = new AlphaCharDocument(fileName);
43
         Document documentWriter = new AlphaCharDocument(fileName);
44
 
44
 

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentOverwriteTest.java View File

13
     @Test
13
     @Test
14
     public void writeTest1() throws IOException {
14
     public void writeTest1() throws IOException {
15
         // given
15
         // given
16
-        String fileName = "file.txt";
16
+        String fileName = "target/file.txt";
17
         String contentToBeOverwritten = "The quick brown fox";
17
         String contentToBeOverwritten = "The quick brown fox";
18
         String expected = "The quick browner fox";
18
         String expected = "The quick browner fox";
19
         Document documentWriter = new Document(fileName);
19
         Document documentWriter = new Document(fileName);
30
     @Test
30
     @Test
31
     public void writeTest2() throws IOException {
31
     public void writeTest2() throws IOException {
32
         // given
32
         // given
33
-        String fileName = "file.txt";
33
+        String fileName = "target/file.txt";
34
         String contentToBeOverwritten = "The quick brown fox";
34
         String contentToBeOverwritten = "The quick brown fox";
35
         String expected = "The quick brownest fox";
35
         String expected = "The quick brownest fox";
36
         Document documentWriter = new Document(fileName);
36
         Document documentWriter = new Document(fileName);

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentReadLineTest.java View File

14
     public void testReadFirstLine() throws IOException {
14
     public void testReadFirstLine() throws IOException {
15
         // given
15
         // given
16
         String expected = "The";
16
         String expected = "The";
17
-        String fileName = "file.txt";
17
+        String fileName = "target/file.txt";
18
         Document documentWriter = new Document(fileName);
18
         Document documentWriter = new Document(fileName);
19
         String contentToBeWritten = "The\nquick\nbrown\nfox";
19
         String contentToBeWritten = "The\nquick\nbrown\nfox";
20
         documentWriter.write(contentToBeWritten);
20
         documentWriter.write(contentToBeWritten);
31
     public void testReadSecondLine() throws IOException {
31
     public void testReadSecondLine() throws IOException {
32
         // given
32
         // given
33
         String expected = "quick";
33
         String expected = "quick";
34
-        String fileName = "file.txt";
34
+        String fileName = "target/file.txt";
35
         Document documentWriter = new Document(fileName);
35
         Document documentWriter = new Document(fileName);
36
         String contentToBeWritten = "The\nquick\nbrown\nfox";
36
         String contentToBeWritten = "The\nquick\nbrown\nfox";
37
         documentWriter.write(contentToBeWritten);
37
         documentWriter.write(contentToBeWritten);

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentReadTest.java View File

13
     @Test
13
     @Test
14
     public void testRead1() throws IOException {
14
     public void testRead1() throws IOException {
15
         // given
15
         // given
16
-        String fileName = "file.txt";
16
+        String fileName = "target/file.txt";
17
         Document documentWriter = new Document(fileName);
17
         Document documentWriter = new Document(fileName);
18
         String expected = "The\nquick\nbrown\nfox";
18
         String expected = "The\nquick\nbrown\nfox";
19
         documentWriter.write(expected);
19
         documentWriter.write(expected);
28
     @Test
28
     @Test
29
     public void testRead2() throws IOException {
29
     public void testRead2() throws IOException {
30
         // given
30
         // given
31
-        String fileName = "file.txt";
31
+        String fileName = "target/file.txt";
32
         Document documentWriter = new Document(fileName);
32
         Document documentWriter = new Document(fileName);
33
         String expected = "The\nquicker\nbrown\nfox";
33
         String expected = "The\nquicker\nbrown\nfox";
34
         documentWriter.write(expected);
34
         documentWriter.write(expected);

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentReplaceAllTest.java View File

13
     @Test
13
     @Test
14
     public void testReplace_e_withUnderscore() throws IOException {
14
     public void testReplace_e_withUnderscore() throws IOException {
15
         // given
15
         // given
16
-        String fileName = "file.txt";
16
+        String fileName = "target/file.txt";
17
         Document documentWriter = new Document(fileName);
17
         Document documentWriter = new Document(fileName);
18
         String contentToBeWritten = "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris\nnisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\nnon proident, sunt in culpa qui officia deserunt mollit anim id est laborum";
18
         String contentToBeWritten = "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris\nnisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\nnon proident, sunt in culpa qui officia deserunt mollit anim id est laborum";
19
         String valueToReplace = "e";
19
         String valueToReplace = "e";
32
     @Test
32
     @Test
33
     public void testReplace_newLine_withEmptyString() throws IOException {
33
     public void testReplace_newLine_withEmptyString() throws IOException {
34
         // given
34
         // given
35
-        String fileName = "file.txt";
35
+        String fileName = "target/file.txt";
36
         Document documentWriter = new Document(fileName);
36
         Document documentWriter = new Document(fileName);
37
         String contentToBeWritten = "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris\nnisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\nnon proident, sunt in culpa qui officia deserunt mollit anim id est laborum";
37
         String contentToBeWritten = "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit,\nsed do eiusmod tempor incididunt\nut labore et dolore\nmagna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris\nnisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate\nvelit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat\nnon proident, sunt in culpa qui officia deserunt mollit anim id est laborum";
38
         String valueToReplace = "\n";
38
         String valueToReplace = "\n";

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentToStringTest.java View File

13
     @Test
13
     @Test
14
     public void toStringTest1() throws IOException {
14
     public void toStringTest1() throws IOException {
15
         // given
15
         // given
16
-        String fileName = "file.txt";
16
+        String fileName = "target/file.txt";
17
         String contentToBeWritten = "The quick brown fox";
17
         String contentToBeWritten = "The quick brown fox";
18
         Document documentWriter = new Document(fileName);
18
         Document documentWriter = new Document(fileName);
19
         String expected = new StringBuilder(fileName)
19
         String expected = new StringBuilder(fileName)
33
     @Test
33
     @Test
34
     public void toStringTest2() throws IOException {
34
     public void toStringTest2() throws IOException {
35
         // given
35
         // given
36
-        String fileName = "file.txt";
36
+        String fileName = "target/file.txt";
37
         String contentToBeWritten = "The quicker browner fox";
37
         String contentToBeWritten = "The quicker browner fox";
38
         Document documentWriter = new Document(fileName);
38
         Document documentWriter = new Document(fileName);
39
         String expected = new StringBuilder(fileName)
39
         String expected = new StringBuilder(fileName)

+ 3
- 3
src/test/java/rocks/zipcode/document/DocumentWriteTest.java View File

14
     @Test
14
     @Test
15
     public void writeAlphaValuesTest() throws IOException {
15
     public void writeAlphaValuesTest() throws IOException {
16
         // given
16
         // given
17
-        String fileName = "file.txt";
17
+        String fileName = "target/file.txt";
18
         String expected = "The quick brown fox";
18
         String expected = "The quick brown fox";
19
         Document documentWriter = new Document(fileName);
19
         Document documentWriter = new Document(fileName);
20
 
20
 
29
     @Test
29
     @Test
30
     public void writeSpecialCharactersTest() throws IOException {
30
     public void writeSpecialCharactersTest() throws IOException {
31
         // given
31
         // given
32
-        String fileName = "file.txt";
32
+        String fileName = "target/file.txt";
33
         String expected = "()";
33
         String expected = "()";
34
         Document documentWriter = new Document(fileName);
34
         Document documentWriter = new Document(fileName);
35
 
35
 
44
     @Test
44
     @Test
45
     public void writeNumericValuesTest() throws IOException {
45
     public void writeNumericValuesTest() throws IOException {
46
         // given
46
         // given
47
-        String fileName = "file.txt";
47
+        String fileName = "target/file.txt";
48
         String expected = "123";
48
         String expected = "123";
49
         Document documentWriter = new Document(fileName);
49
         Document documentWriter = new Document(fileName);
50
 
50
 

+ 2
- 2
src/test/java/rocks/zipcode/document/DocumentWriteToLineTest.java View File

13
     @Test
13
     @Test
14
     public void writeToLineTest1() throws IOException {
14
     public void writeToLineTest1() throws IOException {
15
         // given
15
         // given
16
-        String fileName = "file.txt";
16
+        String fileName = "target/file.txt";
17
         String contentToBeWritten = "The\nquick\nbrown\nfox";
17
         String contentToBeWritten = "The\nquick\nbrown\nfox";
18
         String replacement = "quicker";
18
         String replacement = "quicker";
19
         String expected = contentToBeWritten.replaceAll("quick", replacement);
19
         String expected = contentToBeWritten.replaceAll("quick", replacement);
31
     @Test
31
     @Test
32
     public void writeToLineTest2() throws IOException {
32
     public void writeToLineTest2() throws IOException {
33
         // given
33
         // given
34
-        String fileName = "file.txt";
34
+        String fileName = "target/file.txt";
35
         String contentToBeWritten = "The\nquick\nbrown\nfox";
35
         String contentToBeWritten = "The\nquick\nbrown\nfox";
36
         String replacement = "quickest";
36
         String replacement = "quickest";
37
         String expected = contentToBeWritten.replaceAll("The", replacement);
37
         String expected = contentToBeWritten.replaceAll("The", replacement);

+ 3
- 3
src/test/java/rocks/zipcode/numericdocument/NumericDocumentWriteTest.java View File

15
     @Test
15
     @Test
16
     public void writeNumericValuesToFile() throws IOException {
16
     public void writeNumericValuesToFile() throws IOException {
17
         // given
17
         // given
18
-        String fileName = "file.txt";
18
+        String fileName = "target/file.txt";
19
         String contentToBeWritten = "123";
19
         String contentToBeWritten = "123";
20
         Document documentWriter = new NumericCharDocument(fileName);
20
         Document documentWriter = new NumericCharDocument(fileName);
21
 
21
 
26
     @Test(expected = IllegalArgumentException.class)
26
     @Test(expected = IllegalArgumentException.class)
27
     public void writeSpecialCharacter() throws IOException {
27
     public void writeSpecialCharacter() throws IOException {
28
         // given
28
         // given
29
-        String fileName = "file.txt";
29
+        String fileName = "target/file.txt";
30
         String contentToBeWritten = "()";
30
         String contentToBeWritten = "()";
31
         Document documentWriter = new NumericCharDocument(fileName);
31
         Document documentWriter = new NumericCharDocument(fileName);
32
 
32
 
37
     @Test(expected = IllegalArgumentException.class)
37
     @Test(expected = IllegalArgumentException.class)
38
     public void writeAlphaValuesTest() throws IOException {
38
     public void writeAlphaValuesTest() throws IOException {
39
         // given
39
         // given
40
-        String fileName = "file.txt";
40
+        String fileName = "target/file.txt";
41
         String expected = "The quick brown foxy";
41
         String expected = "The quick brown foxy";
42
         Document documentWriter = new NumericCharDocument(fileName);
42
         Document documentWriter = new NumericCharDocument(fileName);
43
 
43
 

+ 4
- 4
src/test/java/rocks/zipcode/specialdocument/SpecialCharDocumentTest.java View File

15
     @Test(expected = IllegalArgumentException.class)
15
     @Test(expected = IllegalArgumentException.class)
16
     public void writeNumericValuesToFile() throws IOException {
16
     public void writeNumericValuesToFile() throws IOException {
17
         // given
17
         // given
18
-        String fileName = "file.txt";
18
+        String fileName = "target/file.txt";
19
         String contentToBeWritten = "123";
19
         String contentToBeWritten = "123";
20
         Document documentWriter = new SpecialCharDocument(fileName);
20
         Document documentWriter = new SpecialCharDocument(fileName);
21
 
21
 
26
     @Test
26
     @Test
27
     public void writeSpecialCharacter1() throws IOException {
27
     public void writeSpecialCharacter1() throws IOException {
28
         // given
28
         // given
29
-        String fileName = "file.txt";
29
+        String fileName = "target/file.txt";
30
         String contentToBeWritten = "()";
30
         String contentToBeWritten = "()";
31
         Document documentWriter = new SpecialCharDocument(fileName);
31
         Document documentWriter = new SpecialCharDocument(fileName);
32
 
32
 
38
     @Test
38
     @Test
39
     public void writeSpecialCharacter2() throws IOException {
39
     public void writeSpecialCharacter2() throws IOException {
40
         // given
40
         // given
41
-        String fileName = "file.txt";
41
+        String fileName = "target/file.txt";
42
         String contentToBeWritten = "()_*";
42
         String contentToBeWritten = "()_*";
43
         Document documentWriter = new SpecialCharDocument(fileName);
43
         Document documentWriter = new SpecialCharDocument(fileName);
44
 
44
 
50
     @Test(expected = IllegalArgumentException.class)
50
     @Test(expected = IllegalArgumentException.class)
51
     public void writeAlphaValuesTest() throws IOException {
51
     public void writeAlphaValuesTest() throws IOException {
52
         // given
52
         // given
53
-        String fileName = "file.txt";
53
+        String fileName = "target/file.txt";
54
         String expected = "The quick brown foxy";
54
         String expected = "The quick brown foxy";
55
         Document documentWriter = new SpecialCharDocument(fileName);
55
         Document documentWriter = new SpecialCharDocument(fileName);
56
 
56