-
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.
Collapse Java getters and setters into fields
- Loading branch information
Showing
8 changed files
with
131 additions
and
25 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
42 changes: 42 additions & 0 deletions
42
src/test/java/hu/webhejj/perspektive/testmodel/JavaBeanModel.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,42 @@ | ||
package hu.webhejj.perspektive.testmodel; | ||
|
||
import java.util.Objects; | ||
|
||
public class JavaBeanModel { | ||
|
||
private String field; | ||
private Boolean bool; | ||
|
||
public String getField() { | ||
return field; | ||
} | ||
|
||
public void setField(String field) { | ||
this.field = field; | ||
} | ||
|
||
public Boolean isBool() { | ||
return bool; | ||
} | ||
|
||
public void setBool(Boolean bool) { | ||
this.bool = bool; | ||
} | ||
|
||
public String method(String arg) { | ||
return arg; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
JavaBeanModel that = (JavaBeanModel) o; | ||
return Objects.equals(field, that.field) && Objects.equals(bool, that.bool); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(field, bool); | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
.../perspektive/testmodel/TestJavaModel.java → ...erspektive/testmodel/JavaStaticModel.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
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 |
---|---|---|
@@ -1,59 +1,74 @@ | ||
package hu.webhejj.perspektive | ||
|
||
import hu.webhejj.perspektive.testmodel.AbstractClass | ||
import hu.webhejj.perspektive.testmodel.ComplexDataClass | ||
import hu.webhejj.perspektive.testmodel.GenericDataClass | ||
import hu.webhejj.perspektive.testmodel.GenericDataClass2 | ||
import hu.webhejj.perspektive.testmodel.ListContainer | ||
import hu.webhejj.perspektive.testmodel.MapContainer | ||
import hu.webhejj.perspektive.testmodel.SubClass | ||
import hu.webhejj.perspektive.testmodel.TestJavaModel | ||
import hu.webhejj.perspektive.testmodel.JavaBeanModel | ||
import hu.webhejj.perspektive.testmodel.JavaStaticModel | ||
import org.junit.jupiter.api.Test | ||
import java.io.File | ||
|
||
class TestModelTest { | ||
|
||
private val targetDir = File("build/ktuml/") | ||
private val targetDir = File("build/perspektive/") | ||
|
||
@Test | ||
fun testModel() { | ||
fun `data class`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(SubClass::class) | ||
classDiagram.scanKClass(GenericDataClass2::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testModel.plantuml")) | ||
classDiagram.scanKClass(ComplexDataClass::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "data-class.plantuml")) | ||
} | ||
|
||
@Test | ||
fun testTypeParameters() { | ||
fun `generic data class`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(GenericDataClass::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testTypeParameters.plantuml")) | ||
classDiagram.renderWithPlantUml(File(targetDir, "generic-data-class.plantuml")) | ||
} | ||
|
||
@Test | ||
fun testListFields() { | ||
fun subclass() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(SubClass::class) | ||
classDiagram.scanKClass(GenericDataClass2::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "subclass.plantuml")) | ||
} | ||
|
||
@Test | ||
fun `list container`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(ListContainer::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testListFields.plantuml")) | ||
classDiagram.renderWithPlantUml(File(targetDir, "list-container.plantuml")) | ||
} | ||
|
||
@Test | ||
fun testMapFields() { | ||
fun `map container`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(MapContainer::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testMapFields.plantuml")) | ||
classDiagram.renderWithPlantUml(File(targetDir, "map-container.plantuml")) | ||
} | ||
|
||
@Test | ||
fun testAbstractClass() { | ||
fun `abstract class`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(AbstractClass::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testAbstractClass.plantuml")) | ||
classDiagram.renderWithPlantUml(File(targetDir, "abstract-class.plantuml")) | ||
} | ||
|
||
@Test | ||
fun `java static`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(JavaStaticModel::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "java-static.plantuml")) | ||
} | ||
|
||
@Test | ||
fun testStatic() { | ||
fun `java bean`() { | ||
val classDiagram = ClassDiagram() | ||
classDiagram.scanKClass(TestJavaModel::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "testStatic.plantuml")) | ||
classDiagram.scanKClass(JavaBeanModel::class) | ||
classDiagram.renderWithPlantUml(File(targetDir, "java-bean.plantuml")) | ||
} | ||
} |
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