У меня есть следующие перечисление, типаж и класс.
enum FileFormat {
V2, V3
}
trait FileSet {
int fileSetId
List<DataFile> srcFiles = Collections.emptyList()
boolean header = false
boolean mixedPack = false
FileFormat format
List<String> getSrcFileNames() {
srcFiles.collect { it -> it.getSrcFileName() }
}
int getFileCount() {
srcFiles.size()
}
abstract boolean isValid()
def addFile(HeaderFileType hdrType) {
def f = DataFile()
}
}
@Builder(builderMethodName = "builder", buildMethodName = "build", prefix = "with", excludes = "srcFileNames, valid, fileCount")
class VolumeFileSet implements FileSet {
@Override
boolean isValid() {
//TODO implement based on VolumeFileSet validation rules
return true
}
}
Когда я пытаюсь использовать построитель для установки перечисления format
, я получаю сообщение об ошибке
groovy.lang.MissingMethodException: No signature of method: static com.tccc.bia.testdrive.nsr.VolumeFileSet.witFormat() is applicable for argument types: (com.tccc.bia.testdrive.nsr.FileFormat) values: [V3]
Possible solutions: setFormat(com.tccc.bia.testdrive.nsr.FileFormat), getFormat()
Вот тест
class TestSpec extends Specification {
def setupSpec() {
def volumeFileSet = VolumeFileSet
.builder()
.withHeader(true)
.withMixedPack(true)
.witFormat(FileFormat.V3) //ERROR here
.build()
}
}