@@ -77,11 +77,11 @@ describe('JDK installer', function() {
7777 sandbox . restore ( ) ;
7878 } ) ;
7979
80- function mockDetectedJvm ( version , location = 'java.home = /java/home\n' ) {
80+ function mockDetectedJvm ( version , location = 'java.home = /java/home\n' , buildDate = '2018-03-20' ) {
8181 sandbox . stub ( JdkInstall . prototype , 'findMsiInstalledJava' ) . resolves ( '' ) ;
8282 sandbox . stub ( JdkInstall . prototype , 'findDarwinJava' ) . resolves ( '' ) ;
8383 sandbox . stub ( Util , 'executeCommand' )
84- . onFirstCall ( ) . resolves ( `version "${ version } "` )
84+ . onFirstCall ( ) . resolves ( `version "${ version } " ${ buildDate } ` )
8585 . onSecondCall ( ) . resolves ( location ) ;
8686 sandbox . stub ( Util , 'executeFile' ) . resolves ( 'optput' ) ;
8787 sandbox . stub ( child_process , 'exec' ) . yields ( undefined , 'output' ) ;
@@ -139,6 +139,22 @@ describe('JDK installer', function() {
139139 jdk . validateVersion ( ) ;
140140 } ) ;
141141
142+ it ( 'should detect Java 9 and mark it as invalid' , function ( ) {
143+ mockDetectedJvm ( '9.0.4.1-redhat' ) ;
144+ return jdk . detectExistingInstall ( ) . then ( ( ) => {
145+ expect ( jdk . selectedOption ) . to . be . equal ( 'detected' ) ;
146+ expect ( jdk . option . detected . valid ) . to . be . equal ( false ) ;
147+ } ) ;
148+ } ) ;
149+
150+ it ( 'should detect Java 10 and mark it as invalid' , function ( ) {
151+ mockDetectedJvm ( '10' ) ;
152+ return jdk . detectExistingInstall ( ) . then ( ( ) => {
153+ expect ( jdk . selectedOption ) . to . be . equal ( 'detected' ) ;
154+ expect ( jdk . option . detected . valid ) . to . be . equal ( false ) ;
155+ } ) ;
156+ } ) ;
157+
142158 describe ( 'on windows' , function ( ) {
143159 beforeEach ( function ( ) {
144160 sandbox . stub ( Platform , 'getOS' ) . returns ( 'win32' ) ;
@@ -168,7 +184,7 @@ describe('JDK installer', function() {
168184 } ) ;
169185
170186 it ( 'should reject openjdk if location for java is not found' , function ( ) {
171- mockDetectedJvm ( '1.8.0 ' , '' ) ;
187+ mockDetectedJvm ( '' , '' ) ;
172188 return jdk . detectExistingInstall ( ) . then ( ( ) => {
173189 expect ( jdk . selectedOption ) . to . be . equal ( 'install' ) ;
174190 } ) ;
@@ -271,7 +287,7 @@ describe('JDK installer', function() {
271287 mockDetectedJvm ( '1.9.0_1' ) ;
272288 return jdk . detectExistingInstall ( ) . then ( ( ) => {
273289 expect ( jdk . selectedOption ) . to . be . equal ( 'detected' ) ;
274- expect ( jdk . option . detected . version ) . to . be . equal ( '1.9.0 ' ) ;
290+ expect ( jdk . option . detected . version ) . to . be . equal ( '1.9.0_1 ' ) ;
275291 Util . executeCommand . rejects ( ) ;
276292 return jdk . detectExistingInstall ( ) ;
277293 } ) . then ( ( ) => {
0 commit comments