if (className == null) {
throw new IllegalArgumentException("Java filename can not be null");
}
- if (className.indexOf('$') >= 0) {
- throw new IllegalArgumentException("Java inner classes are not supported : " + className);
- }
this.filename = StringUtils.trim(className);
String key;
if (StringUtils.isBlank(packageKey)) {
if (key == null) {
throw new IllegalArgumentException("Java filename can not be null");
}
- if (key.indexOf('$') >= 0) {
- throw new IllegalArgumentException("Java inner classes are not supported : " + key);
- }
String realKey = StringUtils.trim(key);
this.unitTest = unitTest;
assertThat(javaClass.getParent().getKey(), is("org.foo.bar"));
}
- @Test(expected = IllegalArgumentException.class)
- public void doNotAcceptInnerClasses() {
- new JavaFile("org.foo.bar", "Hello$Bar");
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void doNotAcceptInnerClasses2() {
- new JavaFile("org.foo.bar.Hello$Bar");
+ @Test
+ public void shouldAcceptFilenamesWithDollars() {
+ // $ is not used only for inner classes !!!
+ JavaFile javaFile = new JavaFile("org.foo.bar", "Hello$Bar");
+ assertThat(javaFile.getKey(), is("org.foo.bar.Hello$Bar"));
}
@Test