Skip to content

Commit

Permalink
Test for Java compilation with package name case-rename
Browse files Browse the repository at this point in the history
  • Loading branch information
lptr committed Sep 26, 2016
1 parent 2e543f3 commit c2125bc
Showing 1 changed file with 64 additions and 0 deletions.
Expand Up @@ -209,4 +209,68 @@ class JavaCompileIntegrationTest extends AbstractIntegrationSpec {
}
"""
}

def "can compile after package rename"() {
buildFile << """
apply plugin: "java"
repositories {
mavenCentral()
}
dependencies {
testCompile "junit:junit:4.12"
}
"""

file("src/main/java/com/example/Foo.java") << """
package com.example;
public class Foo {}
"""
file("src/test/java/com/example/FooTest.java") << """
package com.example;
import org.junit.Test;
public class FooTest {
@Test
public void test() {
new com.example.Foo();
}
}
"""

when:
succeeds "test"
then:
nonSkippedTasks.contains ":test"
file("build/classes/main/com/example/Foo.class").file

when:
// Move source file to case-renamed package
file("src/main/java/com/example").deleteDir()
file("src/main/java/com/Example/Foo.java") << """
package com.Example;
public class Foo {}
"""
file("src/test/java/com/example/FooTest.java").text = """
package com.example;
import org.junit.Test;
public class FooTest {
@Test
public void test() {
new com.Example.Foo();
}
}
"""

succeeds "test"
then:
nonSkippedTasks.contains ":test"
file("build/classes/main/com/Example/Foo.class").file
}
}

0 comments on commit c2125bc

Please sign in to comment.