Misleading test results

I have recently been working on the Dependency Check gradle plugin which you can find, here.

As any good developer would do, I started by writing a unit test to sketch how I wanted the DSL to work. You can see that here. (I just high-fived myself)

When I change the property outputDirectory in the DSL, this change is then reflected in the task.outputDirectory. However, when I build and apply the plugin, because I didn’t use the accessor method in the task action the DSL isn’t honoured.

I later proved this behaviour with an integration test, and subsequent fix. But I guess if I’m honest I’m not sure why this behaviour exists. I tried stepping through the code, but it didn’t draw any conclusions.

Any help with understanding would be very welcome.