-
Notifications
You must be signed in to change notification settings - Fork 332
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
removing final to enable mocking this class #250
Conversation
@@ -13,7 +13,7 @@ | |||
* | |||
* @author Otávio Scherer Garcia | |||
*/ | |||
public final class Parameter implements AnnotatedElement { | |||
public class Parameter implements AnnotatedElement { |
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.
The problem is that Parameter from Java 8 is final, and the proposal for this is to be closer to Java 8. Changing this the tests will break in Java 8 environments.
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.
Well... any ideas on how to intantiate this class for testing? I don't want
to provide a real AccessibleObject instance or to mock full Constructor or
Method methods...
Chico Sokol
On Wed, Nov 6, 2013 at 11:05 AM, Otávio Garcia notifications@gitpro.ttaallkk.topwrote:
In vraptor-core/src/main/java/br/com/caelum/vraptor/http/Parameter.java:
@@ -13,7 +13,7 @@
*
- @author Otávio Scherer Garcia
*/
-public final class Parameter implements AnnotatedElement {
+public class Parameter implements AnnotatedElement {The problem is that Parameter from Java 8 is final, and the proposal for
this is to be closer to Java 8. Changing this the tests will break in Java
8 environments.—
Reply to this email directly or view it on GitHubhttps://github.com//pull/250/files#r7462564
.
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.
I think better... we can change this removing final. Java 8 allow us to use Method.getParameters
without using ParameterNameProvider
, so these classes will be removed.
Ship this :)
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.
\o/
Chico Sokol
On Wed, Nov 6, 2013 at 11:26 AM, Otávio Garcia notifications@gitpro.ttaallkk.topwrote:
In vraptor-core/src/main/java/br/com/caelum/vraptor/http/Parameter.java:
@@ -13,7 +13,7 @@
*
- @author Otávio Scherer Garcia
*/
-public final class Parameter implements AnnotatedElement {
+public class Parameter implements AnnotatedElement {I think better... we can change this removing final. Java 8 allow us to
use Method.getParameters without using ParameterNameProvider, so these
classes will be removed.Ship this :)
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/250/files#r7462938
.
removing final to enable mocking this class
Since this class its hard to instantiate, it should not be final so that we can mock it for testing.
I'm trying to update vraptor-plugin-hibernate4 and we need to mock Parameter class in its tests.
btw, we have two repositories for vraptor-plugin-hibernate4, the one in @garcia-jj and in @caelum, I'm developing in the caelum repo...