Set project name property in a test


(Phil Swenson) #1

I have a gradle test and need to override the project.name property. Here is my code:

project = org.gradle.testfixtures.ProjectBuilder.builder().build()
project.setProperty("name", "eda-eventtypeeditor-isdoctype")

unfortunately, the name property is read-only so I get a ““Cannot set the value of read-only property ‘name’ on root project ‘test’.””

Is there a way to set my project name for my test? thanks


(Phil Swenson) #2

here is the answer:

project.metaClass.getName {"eda-eventtypeeditor-isdoctype"}

(Sion Williams) #3

Thank you for sharing your fix, this has helped me a lot.