protected static String createDotStoryName ( String scenarioName ) { String [ ] words = scenarioName . trim ( ) . split ( " " ) ; String result = "" ; for ( int i = 0 ; i < words . length ; i ++ ) { String word1 = words [ i ] ; String word2 = word1 . toLowerCase ( ) ; if ( ! word1 . equals ( word2 ) ) { String finalWord = "" ; for ( int j = 0 ; j < word1 . length ( ) ; j ++ ) { if ( i != 0 ) { char c = word1 . charAt ( j ) ; if ( Character . isUpperCase ( c ) ) { if ( j == 0 ) { finalWord += Character . toLowerCase ( c ) ; } else { finalWord += "_" + Character . toLowerCase ( c ) ; } } else { finalWord += c ; } } else { finalWord = word2 ; break ; } } result += finalWord ; } else { result += word2 ; } // I don't add the '_' to the last word. if ( ! ( i == words . length - 1 ) ) result += "_" ; } return result ; }
Creates the name of the . story file to be wrote with the testcase . The name of the scenario must be given with spaces .