Testing custom gradle plugin with GradleRunner

I'm taking a stab at developing a (Java only) gradle plugin (https://github.com/jdeppe-pivotal/test-in-docker). The gradle structure is very vanilla and my plugin code is in src/main/java.

I'm trying to use the GradleRunner for an integration test and have a test build.gradle resource file:

apply plugin: 'io.pivotal.test.docker-plugin'

task helloWorld {
    doLast {
        println "Hello World!"
    }
}

The relevant bits of test code are:

BuildResult result = GradleRunner.create()
    .withProjectDir(testProjectDir.getRoot())
    .withArguments("helloWorld")
    .withPluginClasspath()
    .build();

assertThat(result.getOutput()).contains("Hello World!");
assertThat(result.task(":helloWorld").getOutcome()).isEqualTo(TaskOutcome.SUCCESS);

However, the test build fails with:

> Plugin with id 'io.pivotal.test.docker-plugin' not found.

I can see that (what appears to be) a correct classpath is being set with .withPluginClasspath() in the GradleRunner call. What am I doing wrong here?

UPDATE:

Changing the test resource build.gradle to reference the plugin as follows:

plugins {
    id 'io.pivotal.test.docker-plugin'
}

works.