Loading ...
Sorry, an error occurred while loading the content.

Migration to JUnit 4.10

Expand Messages
  • zekey99854
    Hello, I recently migrated 4.10 and I ve got the following warning in a class that extends BlockJUnit4ClassRunner: The method withBefores(FrameworkMethod,
    Message 1 of 3 , Apr 3 5:05 AM
    View Source
    • 0 Attachment
      Hello,

      I recently migrated 4.10 and I've got the following warning in a class that extends BlockJUnit4ClassRunner:

      The method withBefores(FrameworkMethod, Object, Statement) from the type BlockJUnit4ClassRunner is deprecated.

      Here is the class
      public class DerbyWeldJUnit4Runner extends WeldJUnit4Runner {
      ...
      /**
      * Initializes the Database state. {@inheritDoc}
      */
      @Override
      protected final Statement withBefores(final FrameworkMethod method,
      final Object target, final Statement statement) {
      ....
      return super.withBefores(method, target, statement);
      }
      }

      In the javadoc, it is written that I should use Rules. I have three issues/questions regarding that modification:

      1) I use BlockJUnit4ClassRunner not to extends anything specific to the tests
      2) I do not want to add @Rule in the client test class (or in a parent class)
      3) The actual snippet that I used in the withBefores method uses a bunch of objects initialized in the DerbyWeldJUnit4Runner class.

      So here is my question: How can integrate the Rule without having to modify the current client test code? Did I miss something in the design.

      Many thanks in advance
    • David Saff
      Steve, I think we over-aggressively deprecated withBefores. It is unlikely to be truly removed any time soon. Thanks, David Saff ... [Non-text portions of
      Message 2 of 3 , Apr 12 12:08 PM
      View Source
      • 0 Attachment
        Steve,

        I think we over-aggressively deprecated withBefores. It is unlikely to be
        truly removed any time soon. Thanks,

        David Saff

        On Tue, Apr 3, 2012 at 8:05 AM, zekey99854 <steve.hostettler@...>wrote:

        > Hello,
        >
        > I recently migrated 4.10 and I've got the following warning in a class
        > that extends BlockJUnit4ClassRunner:
        >
        > The method withBefores(FrameworkMethod, Object, Statement) from the type
        > BlockJUnit4ClassRunner is deprecated.
        >
        > Here is the class
        > public class DerbyWeldJUnit4Runner extends WeldJUnit4Runner {
        > ...
        > /**
        > * Initializes the Database state. {@inheritDoc}
        > */
        > @Override
        > protected final Statement withBefores(final FrameworkMethod method,
        > final Object target, final Statement statement) {
        > ....
        > return super.withBefores(method, target, statement);
        > }
        > }
        >
        > In the javadoc, it is written that I should use Rules. I have three
        > issues/questions regarding that modification:
        >
        > 1) I use BlockJUnit4ClassRunner not to extends anything specific to the
        > tests
        > 2) I do not want to add @Rule in the client test class (or in a parent
        > class)
        > 3) The actual snippet that I used in the withBefores method uses a bunch
        > of objects initialized in the DerbyWeldJUnit4Runner class.
        >
        > So here is my question: How can integrate the Rule without having to
        > modify the current client test code? Did I miss something in the design.
        >
        > Many thanks in advance
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        >


        [Non-text portions of this message have been removed]
      • Steve Hostettler
        David, thanks for the answer. In that case, I ll stick to the current solution. Best Regards =========== Steve Hostettler ... [Non-text portions of this
        Message 3 of 3 , Apr 12 12:46 PM
        View Source
        • 0 Attachment
          David,

          thanks for the answer. In that case, I'll stick to the current solution.



          Best Regards
          ===========
          Steve Hostettler



          On Apr 12, 2012, at 9:08 PM, David Saff wrote:

          > Steve,
          >
          > I think we over-aggressively deprecated withBefores. It is unlikely to be
          > truly removed any time soon. Thanks,
          >
          > David Saff
          >
          > On Tue, Apr 3, 2012 at 8:05 AM, zekey99854 <steve.hostettler@...>wrote:
          >
          > > Hello,
          > >
          > > I recently migrated 4.10 and I've got the following warning in a class
          > > that extends BlockJUnit4ClassRunner:
          > >
          > > The method withBefores(FrameworkMethod, Object, Statement) from the type
          > > BlockJUnit4ClassRunner is deprecated.
          > >
          > > Here is the class
          > > public class DerbyWeldJUnit4Runner extends WeldJUnit4Runner {
          > > ...
          > > /**
          > > * Initializes the Database state. {@inheritDoc}
          > > */
          > > @Override
          > > protected final Statement withBefores(final FrameworkMethod method,
          > > final Object target, final Statement statement) {
          > > ....
          > > return super.withBefores(method, target, statement);
          > > }
          > > }
          > >
          > > In the javadoc, it is written that I should use Rules. I have three
          > > issues/questions regarding that modification:
          > >
          > > 1) I use BlockJUnit4ClassRunner not to extends anything specific to the
          > > tests
          > > 2) I do not want to add @Rule in the client test class (or in a parent
          > > class)
          > > 3) The actual snippet that I used in the withBefores method uses a bunch
          > > of objects initialized in the DerbyWeldJUnit4Runner class.
          > >
          > > So here is my question: How can integrate the Rule without having to
          > > modify the current client test code? Did I miss something in the design.
          > >
          > > Many thanks in advance
          > >
          > >
          > >
          > > ------------------------------------
          > >
          > > Yahoo! Groups Links
          > >
          > >
          > >
          > >
          >
          > [Non-text portions of this message have been removed]
          >
          >



          [Non-text portions of this message have been removed]
        Your message has been successfully submitted and would be delivered to recipients shortly.