-
-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jooby-apt: Value annotation attribute must be always generated fix #3539
- Loading branch information
Showing
4 changed files
with
85 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* | ||
* Jooby https://jooby.io | ||
* Apache License Version 2.0 https://jooby.io/LICENSE.txt | ||
* Copyright 2014 Edgar Espina | ||
*/ | ||
package tests.i3539; | ||
|
||
import io.jooby.annotation.GET; | ||
|
||
public class C3539 { | ||
@GET("/3539") | ||
@Secured3525 | ||
public void secured() {} | ||
} |
35 changes: 35 additions & 0 deletions
35
modules/jooby-apt/src/test/java/tests/i3539/Issue3539.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,35 @@ | ||
/* | ||
* Jooby https://jooby.io | ||
* Apache License Version 2.0 https://jooby.io/LICENSE.txt | ||
* Copyright 2014 Edgar Espina | ||
*/ | ||
package tests.i3539; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
import java.util.Map; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
import io.jooby.apt.ProcessorRunner; | ||
|
||
public class Issue3539 { | ||
|
||
@Test | ||
public void shouldGenerateAnnotationWithDefaultValue() throws Exception { | ||
new ProcessorRunner(new C3539()) | ||
.withRouter( | ||
app -> { | ||
var routes = app.getRoutes(); | ||
assertNotNull(routes); | ||
assertFalse(routes.isEmpty()); | ||
var route = app.getRoutes().get(0); | ||
assertNotNull(route); | ||
Map<String, Object> attributes = route.getAttributes(); | ||
assertNotNull(attributes); | ||
assertFalse(attributes.isEmpty()); | ||
var secured = attributes.get(Secured3525.class.getSimpleName()); | ||
assertSame(secured, Boolean.TRUE); | ||
}); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
modules/jooby-apt/src/test/java/tests/i3539/Secured3525.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,17 @@ | ||
/* | ||
* Jooby https://jooby.io | ||
* Apache License Version 2.0 https://jooby.io/LICENSE.txt | ||
* Copyright 2014 Edgar Espina | ||
*/ | ||
package tests.i3539; | ||
|
||
import java.lang.annotation.ElementType; | ||
import java.lang.annotation.Retention; | ||
import java.lang.annotation.RetentionPolicy; | ||
import java.lang.annotation.Target; | ||
|
||
@Target({ElementType.METHOD}) | ||
@Retention(RetentionPolicy.RUNTIME) | ||
public @interface Secured3525 { | ||
boolean value() default true; | ||
} |