Thanks Rene. Here's my example:

Here's MyCustomTask implementation:

class MyCustomTask extends DefaultTask
{
    @TaskAction
    def runTask()
    {
        println "main task ran";
        helperMethod()
    }

    public void helperMethod()
    {
        println "helper method called"
    }
}


And here's the test class from where I'm trying to call helperMetho()

class MyCustomTaskTest extends GroovyTestCase
{
    void testHelperMethod()
    {
        Project project = ProjectBuilder.builder().build()
        def sut = project.task('newTask', type: MyCustomTask)

        assertEquals("helper method called", sut.helperMethod())
    }
}


sut.helperMethod() obviously does not work. So, how can I call
helperMethod() on my "sut" object?

--
View this message in context: 
http://gradle.1045684.n5.nabble.com/How-to-Unit-Test-protected-public-methods-in-the-CustomTask-tp4850331p4850601.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to