Testing

Home


© 2019-2022 rxmicro.io. Free use of this software is granted under the terms of the Apache License 2.0.

Copies of this entity may be made for Your own use and for distribution to others, provided that You do not charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether distributed in print or electronically.

If You find errors or omissions in this entity, please don’t hesitate to submit an issue or open a pull request with a fix.

1. Appendix A: FAQ

This section covers a list of possible questions that You can ask yourself when You use the RxMicro framework.

1.1. Does the RxMicro framework modify my byte code?

No. Your classes are Your classes. The RxMicro framework does not transform classes or modify the Java byte code You write. The RxMicro framework produces additional classes only.

1.2. Can the RxMicro framework be used for purposes other than microservices?

Yes. The RxMicro framework is very modular and You can choose to use any module You need.

1.3. Why I receive class not found error?

When You use the RxMicro framework You can receive one of the following errors:

  • Class rxmicro.$$RestControllerAggregatorImpl not found;

  • Class rxmicro.$$RestClientFactoryImpl not found;

  • Class rxmicro.$$RepositoryFactoryImpl not found;

  • Class rxmicro.$$BeanFactoryImpl not found;

These errors mean that the RxMicro Annotation Processor does not generate the required additional classes.

To fix it, please verify that:

  1. pom.xml for Your project contains the valid settings for maven-compiler-plugin and

  2. You executed command: mvn clean compile!

1.4. Why I receive The Kotlin standard library is not found in the module graph error?

Sometimes this issue occurs during the work with java code using IntelliJ IDEA. To fix this issue it is necessary to rebuild Your project: BuildRebuild project.

1.5. Why I receive java.lang.NullPointerException: autoRelease couldn’t be null error during unit testing?

If You declare an alternative of the HttpClientFactory mock and don’t configure it this error can happen.

To fix this issue it is necessary to configure the @Mock annotation:

@Alternative
@Mock(answer = Answers.RETURNS_DEEP_STUBS) (1)
private HttpClientFactory httpClientFactory;
1 Set Answers.RETURNS_DEEP_STUBS as answer value.

1.6. Why I receive java.lang.reflect.InaccessibleObjectException: Unable to make MicroServiceTest() accessible: module module.name does not "opens test.package" to unnamed module error during unit testing?

If test.package name matches to the production.package name, then You need just to add io.rxmicro.annotation.processor.RxMicroTestsAnnotationProcessor annotation processor. (Read more at quick-start.html).

If test.package name does not match to the production.package name, then You need configure the maven-surefire-plugin manually:

<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>${maven-surefire-plugin.version}</version>
    <configuration>
        <argLine>
            @{argLine}
            --add-opens module.name/test.package=ALL-UNNAMED (1)
        </argLine>
    </configuration>
</plugin>
1 Opens all classes from test.package package defined at the module.name module to all unnamed modules!

Testing

Home