1 | |
package org.jbehave.core.io; |
2 | |
|
3 | |
import static org.apache.commons.lang.StringUtils.contains; |
4 | |
import static org.apache.commons.lang.StringUtils.substringAfterLast; |
5 | |
import static org.apache.commons.lang.StringUtils.substringBefore; |
6 | |
import static org.apache.commons.lang.WordUtils.capitalize; |
7 | |
|
8 | 407 | public class UnderscoredToCapitalized implements StoryNameResolver { |
9 | |
|
10 | |
public String resolveName(String path) { |
11 | 25 | String name = path; |
12 | 25 | if ( contains(name, '/') ){ |
13 | 3 | name = substringAfterLast(name, "/"); |
14 | 3 | name = substringBefore(name, "."); |
15 | 22 | } else if ( contains(name, '.') ){ |
16 | 21 | name = substringAfterLast(name, "."); |
17 | |
} |
18 | 25 | return capitalize(name.replace("_", " ")); |
19 | |
} |
20 | |
|
21 | |
} |