@@ -115,10 +115,10 @@ void addCompilerOptionsCallsTheExpectedMethod() {
115115 assertThat (result ).isSameAs (compiler );
116116 }
117117
118- @ DisplayName ("releaseVersion (int) should call releaseVersion (String)" )
118+ @ DisplayName ("release (int) should call release (String)" )
119119 @ ValueSource (ints = {11 , 12 , 13 , 14 , 15 , 16 , 17 })
120120 @ ParameterizedTest (name = "for version = {0}" )
121- void releaseVersionIntCallsReleaseVersionString (int versionInt ) {
121+ void releaseIntCallsReleaseVersionString (int versionInt ) {
122122 // Given
123123 var versionString = "" + versionInt ;
124124 given (compiler .release (anyInt ())).willCallRealMethod ();
@@ -132,10 +132,10 @@ void releaseVersionIntCallsReleaseVersionString(int versionInt) {
132132 assertThat (result ).isSameAs (compiler );
133133 }
134134
135- @ DisplayName ("releaseVersion (int) throws an IllegalArgumentException for negative versions" )
135+ @ DisplayName ("release (int) throws an IllegalArgumentException for negative versions" )
136136 @ ValueSource (ints = {-1 , -2 , -5 , -100_000 })
137137 @ ParameterizedTest (name = "for version = {0}" )
138- void releaseVersionIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
138+ void releaseIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
139139 // Given
140140 given (compiler .release (anyInt ())).willCallRealMethod ();
141141
@@ -145,10 +145,10 @@ void releaseVersionIntThrowsIllegalArgumentExceptionForNegativeVersions(int vers
145145 .hasMessage ("Cannot provide a release version less than 0" );
146146 }
147147
148- @ DisplayName ("releaseVersion (SourceVersion) should call releaseVersion (String)" )
148+ @ DisplayName ("release (SourceVersion) should call release (String)" )
149149 @ MethodSource ("sourceVersions" )
150150 @ ParameterizedTest (name = "for version = {0}" )
151- void releaseVersionSourceVersionCallsReleaseVersionString (
151+ void releaseSourceVersionCallsReleaseVersionString (
152152 SourceVersion versionEnum ,
153153 String versionString
154154 ) {
@@ -164,10 +164,25 @@ void releaseVersionSourceVersionCallsReleaseVersionString(
164164 assertThat (result ).isSameAs (compiler );
165165 }
166166
167- @ DisplayName ("sourceVersion(int) should call sourceVersion(String)" )
167+ @ DisplayName (".useRuntimeRelease() should call .release(int) with the runtime feature version" )
168+ @ Test
169+ void useRuntimeReleaseShouldSetTheRuntimeFeatureVersion () {
170+ // Given
171+ given (compiler .useRuntimeRelease ()).willCallRealMethod ();
172+ given (compiler .release (anyInt ())).will (ctx -> compiler );
173+
174+ // When
175+ var result = compiler .useRuntimeRelease ();
176+
177+ // Then
178+ then (compiler ).should ().release (Runtime .version ().feature ());
179+ assertThat (result ).isSameAs (compiler );
180+ }
181+
182+ @ DisplayName ("source(int) should call source(String)" )
168183 @ ValueSource (ints = {11 , 12 , 13 , 14 , 15 , 16 , 17 })
169184 @ ParameterizedTest (name = "for version = {0}" )
170- void sourceVersionIntCallsReleaseVersionString (int versionInt ) {
185+ void sourceIntCallsReleaseVersionString (int versionInt ) {
171186 // Given
172187 var versionString = "" + versionInt ;
173188 given (compiler .source (anyInt ())).willCallRealMethod ();
@@ -181,10 +196,10 @@ void sourceVersionIntCallsReleaseVersionString(int versionInt) {
181196 assertThat (result ).isSameAs (compiler );
182197 }
183198
184- @ DisplayName ("sourceVersion (int) throws an IllegalArgumentException for negative versions" )
199+ @ DisplayName ("source (int) throws an IllegalArgumentException for negative versions" )
185200 @ ValueSource (ints = {-1 , -2 , -5 , -100_000 })
186201 @ ParameterizedTest (name = "for version = {0}" )
187- void sourceVersionIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
202+ void sourceIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
188203 // Given
189204 given (compiler .source (anyInt ())).willCallRealMethod ();
190205
@@ -194,10 +209,10 @@ void sourceVersionIntThrowsIllegalArgumentExceptionForNegativeVersions(int versi
194209 .hasMessage ("Cannot provide a source version less than 0" );
195210 }
196211
197- @ DisplayName ("sourceVersion (SourceVersion) should call sourceVersion (String)" )
212+ @ DisplayName ("source (SourceVersion) should call source (String)" )
198213 @ MethodSource ("sourceVersions" )
199214 @ ParameterizedTest (name = "for version = {0}" )
200- void sourceVersionSourceVersionCallsReleaseVersionString (
215+ void sourceSourceVersionCallsReleaseVersionString (
201216 SourceVersion versionEnum ,
202217 String versionString
203218 ) {
@@ -213,10 +228,10 @@ void sourceVersionSourceVersionCallsReleaseVersionString(
213228 assertThat (result ).isSameAs (compiler );
214229 }
215230
216- @ DisplayName ("targetVersion (int) should call targetVersion (String)" )
231+ @ DisplayName ("target (int) should call target (String)" )
217232 @ ValueSource (ints = {11 , 12 , 13 , 14 , 15 , 16 , 17 })
218233 @ ParameterizedTest (name = "for version = {0}" )
219- void targetVersionIntCallsReleaseVersionString (int versionInt ) {
234+ void targetIntCallsReleaseVersionString (int versionInt ) {
220235 // Given
221236 var versionString = "" + versionInt ;
222237 given (compiler .target (anyInt ())).willCallRealMethod ();
@@ -230,10 +245,10 @@ void targetVersionIntCallsReleaseVersionString(int versionInt) {
230245 assertThat (result ).isSameAs (compiler );
231246 }
232247
233- @ DisplayName ("targetVersion (int) throws an IllegalArgumentException for negative versions" )
248+ @ DisplayName ("target (int) throws an IllegalArgumentException for negative versions" )
234249 @ ValueSource (ints = {-1 , -2 , -5 , -100_000 })
235250 @ ParameterizedTest (name = "for version = {0}" )
236- void targetVersionIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
251+ void targetIntThrowsIllegalArgumentExceptionForNegativeVersions (int versionInt ) {
237252 // Given
238253 given (compiler .target (anyInt ())).willCallRealMethod ();
239254
@@ -243,10 +258,10 @@ void targetVersionIntThrowsIllegalArgumentExceptionForNegativeVersions(int versi
243258 .hasMessage ("Cannot provide a target version less than 0" );
244259 }
245260
246- @ DisplayName ("targetVersion (SourceVersion) should call targetVersion (String)" )
261+ @ DisplayName ("target (SourceVersion) should call target (String)" )
247262 @ MethodSource ("sourceVersions" )
248263 @ ParameterizedTest (name = "for version = {0}" )
249- void targetVersionSourceVersionCallsReleaseVersionString (
264+ void targetSourceVersionCallsReleaseVersionString (
250265 SourceVersion versionEnum ,
251266 String versionString
252267 ) {
0 commit comments