-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
annotation_experimental_enum #200
Conversation
…I just test the result on ProblemType enum class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! thanks for this first PR ;) There was a bit of misunderstanding... but that's OK ;) let me know if my comment are unclear. we can also discuss them in person (i ll be in the office tomorrow, at least in the afternoon)
@@ -126,13 +126,16 @@ class EMConfig { | |||
} | |||
return description | |||
} | |||
// This is just an example for Problem Type but |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code should not be specific for problemType
, but generic
} | ||
|
||
fun getDescription(m: KMutableProperty<*>): ConfigDescription { | ||
|
||
val cfg = (m.annotations.find { it is Cfg } as? Cfg) | ||
?: throw IllegalArgumentException("Property ${m.name} is not annotated with @Cfg") | ||
|
||
// println(cfg.description) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove all these occurrences of commented out println statements
|
||
@Experimental | ||
@Cfg("The type of SUT we want to generate tests for, e.g., a RESTful API") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove @Experimental
. the option problemType
is not experimental, just the choice WEB
is, for now
@@ -21,12 +21,13 @@ object ConfigToMarkdown { | |||
fun toMarkdown(): String { | |||
|
|||
val buffer = StringBuilder() | |||
|
|||
// | |||
defaultInstance.addAnnotationsEnumExperiment() | |||
addHeader(buffer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove
@@ -103,6 +106,10 @@ object ConfigToMarkdown { | |||
|
|||
val sorted = experimental.sortedBy { it.name } | |||
|
|||
//for (element in sorted) | |||
// println(element.name) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove those commented out code
@@ -180,8 +190,30 @@ object ConfigToMarkdown { | |||
buffer.append(" *Constraints*: `${description.constraints}`.") | |||
} | |||
if(description.enumValues.isNotBlank()){ | |||
buffer.append(" *Valid values*: `${description.enumValues}`.") | |||
var experimentalValues = "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here enumValues
is a string. likely we will need 2 separated strings, one for regular enum values, and another one for experimetal enum values (if any)
{ | ||
|
||
buffer.append(" *Valid values*: `${description.enumValues}`, *Experimental Values*: `This is under work` ") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if there is no experimental value, then the *Experimental values*
label should not be printed (also notice lower case for v
)
@@ -172,10 +175,12 @@ class EMConfig { | |||
val returnType = m.returnType.javaType as Class<*> | |||
|
|||
if (returnType.isEnum) { | |||
|
|||
val elements = returnType.getDeclaredMethod("values") | |||
.invoke(null) as Array<*> | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is where you will need reflection to read annotations, and see if any value is marked with @Experimental
.
likely will need another variable besides enumValues
to keep track of any found experimental enum
In this branch, I solved the annotation @experimental on enum class. I just test the result on ProblemType enum class, however, we can easily generalize to other enum classes.