-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for summarize and no args constructor
- Loading branch information
Showing
10 changed files
with
99 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
lib/src/test/java/de/lomboker/lib/ReduceNoArgsConstructorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package de.lomboker.lib; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class ReduceNoArgsConstructorTest extends FileTest { | ||
|
||
@Test | ||
public void testFuzzyToString() throws IOException { | ||
String fileName = "Fuzzy/Constructor/NoArgs.java"; | ||
String fileNameRef = "Fuzzy/Constructor/NoArgs.reduced.java"; | ||
String input = readFile(fileName); | ||
String expected = readFile(fileNameRef); | ||
|
||
assertEquals(expected, NoArgsConstructor.reduceNoArgsConstructor(input)); | ||
} | ||
|
||
} |
31 changes: 31 additions & 0 deletions
31
lib/src/test/java/de/lomboker/lib/SummarizeGetterSetterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package de.lomboker.lib; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class SummarizeGetterSetterTest extends FileTest { | ||
|
||
@Test | ||
public void shouldSummarizeAllGettersWhenAllFieldsHaveGetters() throws IOException { | ||
String fileName = "Summarize/gs/AllGetterSomeSetter.java"; | ||
String fileNameRef = "Summarize/gs/AllGetterSomeSetter.reduced.java"; | ||
String input = readFile(fileName); | ||
String expected = readFile(fileNameRef); | ||
|
||
assertEquals(expected, SummarizeGetterSetter.summarizeGetters(input)); | ||
assertEquals(input, SummarizeGetterSetter.summarizeSetters(input)); | ||
} | ||
|
||
@Test | ||
public void shouldNotSummarizeAllSettersWhenNotAllFieldsHaveSetters() throws IOException { | ||
String fileName = "Summarize/gs/AllGetterSomeSetter.java"; | ||
String fileNameRef = "Summarize/gs/AllGetterSomeSetter.reduced.java"; | ||
String input = readFile(fileName); | ||
|
||
assertEquals(input, SummarizeGetterSetter.summarizeSetters(input)); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class A { | ||
|
||
public A() { | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import lombok.NoArgsConstructor; | ||
|
||
@NoArgsConstructor | ||
class A { | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/test/resources/Summarize/gs/AllGetterSomeSetter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class A { | ||
|
||
@Getter | ||
@Setter | ||
int a; | ||
|
||
@Getter | ||
@Setter | ||
String b; | ||
|
||
@Getter | ||
boolean c; | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
lib/src/test/resources/Summarize/gs/AllGetterSomeSetter.reduced.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@Getter | ||
class A { | ||
|
||
|
||
@Setter | ||
int a; | ||
|
||
|
||
@Setter | ||
String b; | ||
|
||
boolean c; | ||
|
||
} |