Micronaut 1.0 RC3 and Micronaut Test 1.0 RC1 Released

MICRONAUT 1.0 RC3 AND MICRONAUT TEST 1.0 RC1 RELEASED

By Graeme Rocher, OCI Grails & Micronaut Product Lead and Principal Software Engineer

OCTOBER 16, 2018

With one week to go to Oracle Code One 2018, the Micronaut team at OCI is pleased to announce the release of Micronaut 1.0 RC3.

This is the final RC before we release GA on the 23rd of October.

With this release, we are pleased to also announce the first RC of Micronaut Test: a simple collection of extensions for JUnit 5 and Spock that adds a few niceties that make it simpler to test Micronaut applications.

Micronaut Test adds the following testing-specific features to Micronaut:

  • Automatically start and stop the server for the scope of a test suite

  • Use mocks to replace existing beans for the scope of a test suite

  • Allow dependency injection into a test instance

The following is an example test written in Spock: 

  1. package io.micronaut.test.spock
  2.  
  3. import io.micronaut.test.annotation.MicronautTest
  4. import spock.lang.*
  5. import javax.inject.Inject
  6.  
  7. @MicronautTest
  8. class MathServiceSpec extends Specification {
  9.  
  10. @Inject
  11. MathService mathService
  12.  
  13. @Unroll
  14. void "should compute #num times 4"() {
  15. when:
  16. def result = mathService.compute(num)
  17.  
  18. then:
  19. result == expected
  20.  
  21. where:
  22. num | expected
  23. 2 | 8
  24. 3 | 12
  25. }
  26. }

As you can see from the example above, simply by adding the @MicronautTest annotation to any Spock or JUnit 5 test, the test automatically becomes a candidate for dependency injection.

Micronaut Test includes many more features, including integration with Spock's mocking framework and Mockito for JUnit 5.

Thanks to all those who provided feedback during the RC process and to those who plan to attend Oracle Code One 2018 next week in San Francisco - see you there!

secret