@@ -2515,20 +2515,31 @@ public void getNextVmHostAndDisplayNameGeneratesCorrectHostAndDisplayNameForLinu
25152515 Assert .assertEquals (result .first (), result .second ());
25162516 }
25172517
2518- @ Test
2519- public void getNextVmHostAndDisplayNameGeneratesCorrectHostAndDisplayNameForWindowsTemplate () {
2520- GuestOSVO guestOS = Mockito .mock (GuestOSVO .class );
2518+ private void runGetNextVmHostAndDisplayNameGeneratesCorrectHostAndDisplayNameForWindowsTemplate () {
25212519 when (asVmGroupMock .getName ()).thenReturn (vmGroupName );
25222520 when (asVmGroupMock .getNextVmSeq ()).thenReturn (1L );
25232521 when (templateMock .getGuestOSId ()).thenReturn (1L );
2524- when (guestOS .getName ()).thenReturn ("Windows Server" );
2525- when (guestOSDao .findById (1L )).thenReturn (guestOS );
25262522 Pair <String , String > result = autoScaleManagerImplSpy .getNextVmHostAndDisplayName (asVmGroupMock , templateMock );
25272523 String vmHostNamePattern = AutoScaleManagerImpl .VM_HOSTNAME_PREFIX + vmGroupName +
25282524 "-" + asVmGroupMock .getNextVmSeq () + "-[a-z]{6}" ;
25292525 Assert .assertTrue (result .second ().matches (vmHostNamePattern ));
25302526 Assert .assertEquals (15 , result .first ().length ());
25312527 Assert .assertTrue (result .second ().endsWith (result .first ()));
2528+
2529+ }
2530+
2531+ @ Test
2532+ public void getNextVmHostAndDisplayNameGeneratesCorrectHostAndDisplayNameForWindowsTemplateUsingGuestOsName () {
2533+ GuestOSVO guestOS = Mockito .mock (GuestOSVO .class );
2534+ when (guestOS .getName ()).thenReturn ("Windows Server" );
2535+ when (guestOSDao .findById (1L )).thenReturn (guestOS );
2536+ }
2537+
2538+ @ Test
2539+ public void getNextVmHostAndDisplayNameGeneratesCorrectHostAndDisplayNameForWindowsTemplateUsingGuestOsDisplayName () {
2540+ GuestOSVO guestOS = Mockito .mock (GuestOSVO .class );
2541+ when (guestOS .getDisplayName ()).thenReturn ("Windows Server" );
2542+ when (guestOSDao .findById (1L )).thenReturn (guestOS );
25322543 }
25332544
25342545 @ Test
0 commit comments