Uploaded image for project: 'Forge'
  1. Forge
  2. FORGE-2144

Adding powermock rule into the test will cause forge to be unable to find it

    XMLWordPrintable

Details

    • Bug
    • Resolution: Obsolete
    • Major
    • None
    • None
    • None
    • None
    • Hide

      Steps to reproduce:
      1.) Select whatever test you (don't) like in the Forge.
      2.) Add following public field in the test
      @Rule
      public PowerMockRule rule = new PowerMockRule();
      3.) Add PowerMock dependencies (there is probably a way to play with these and combine them with some different ones):
      <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4-rule</artifactId>
      <version>1.5.6</version>
      <scope>test</scope>
      </dependency>

      <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-module-junit4</artifactId>
      <version>1.5.6</version>
      <scope>test</scope>
      </dependency>

      <dependency>
      <groupId>org.powermock</groupId>
      <artifactId>powermock-api-easymock</artifactId>
      <version>1.5.6</version>
      <scope>test</scope>
      </dependency>

      4.) Run the test and forge will no more be able to find it.

      Show
      Steps to reproduce: 1.) Select whatever test you (don't) like in the Forge. 2.) Add following public field in the test @Rule public PowerMockRule rule = new PowerMockRule(); 3.) Add PowerMock dependencies (there is probably a way to play with these and combine them with some different ones): <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4-rule</artifactId> <version>1.5.6</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-module-junit4</artifactId> <version>1.5.6</version> <scope>test</scope> </dependency> <dependency> <groupId>org.powermock</groupId> <artifactId>powermock-api-easymock</artifactId> <version>1.5.6</version> <scope>test</scope> </dependency> 4.) Run the test and forge will no more be able to find it.

    Description

      Powermock is a framework for mocking static methods (this is a tricky thing to do). By default you will run it using @RunWith annotation, however since the arquillian has it's own @RunWith(Arquillian.class) annotation, it provides an option to use the mocking using the junit.Rule. This, however, makes the tests fail.
      The difference is in the registry.getExportedInstance() for the DEFAULT addon. In one it returns the class, in the other it does not.

      Recently, there was added another way of running the powermock along arquillian using java agent, even though it is not easy to make this work, it looks it fails on same error.

      Error:
      java.lang.IllegalStateException: Test runner could not locate test class [org.jboss.windup.rules.java.NotUnzippableFileTest] in any deployed Addon.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mbriskar_jira Matej Briskar (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: