Avoid mutating final fields · junit-team/junit-framework@9b90b24 (original) (raw)

`@@ -75,91 +75,91 @@ public static class SelectorOptions {

`

75

75

``

76

76

`@Option(names = { "-u",

`

77

77

`"--select-uri" }, paramLabel = "URI", arity = "1..*", converter = SelectorConverter.Uri.class, description = "Select a URI for test discovery. This option can be repeated.")

`

78

``

`-

private final List selectedUris = new ArrayList<>();

`

``

78

`+

private List selectedUris = new ArrayList<>();

`

79

79

``

80

80

`@Option(names = { "--u",

`

81

81

`"-select-uri" }, arity = "1..*", hidden = true, converter = SelectorConverter.Uri.class)

`

82

``

`-

private final List selectedUris2 = new ArrayList<>();

`

``

82

`+

private List selectedUris2 = new ArrayList<>();

`

83

83

``

84

84

`@Option(names = { "-f",

`

85

85

`"--select-file" }, paramLabel = "FILE", arity = "1..*", converter = SelectorConverter.File.class, //

`

86

86

`description = "Select a file for test discovery. "

`

87

87

` + "The line and column numbers can be provided as URI query parameters (e.g. foo.txt?line=12&column=34). "

`

88

88

` + "This option can be repeated.")

`

89

``

`-

private final List selectedFiles = new ArrayList<>();

`

``

89

`+

private List selectedFiles = new ArrayList<>();

`

90

90

``

91

91

`@Option(names = { "--f",

`

92

92

`"-select-file" }, arity = "1..*", hidden = true, converter = SelectorConverter.File.class)

`

93

``

`-

private final List selectedFiles2 = new ArrayList<>();

`

``

93

`+

private List selectedFiles2 = new ArrayList<>();

`

94

94

``

95

95

`@Option(names = { "-d",

`

96

96

`"--select-directory" }, paramLabel = "DIR", arity = "1..*", converter = SelectorConverter.Directory.class, description = "Select a directory for test discovery. This option can be repeated.")

`

97

``

`-

private final List selectedDirectories = new ArrayList<>();

`

``

97

`+

private List selectedDirectories = new ArrayList<>();

`

98

98

``

99

99

`@Option(names = { "--d",

`

100

100

`"-select-directory" }, arity = "1..*", hidden = true, converter = SelectorConverter.Directory.class)

`

101

``

`-

private final List selectedDirectories2 = new ArrayList<>();

`

``

101

`+

private List selectedDirectories2 = new ArrayList<>();

`

102

102

``

103

103

`@Option(names = { "-o",

`

104

104

`"--select-module" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Module.class, description = "Select single module for test discovery. This option can be repeated.")

`

105

``

`-

private final List selectedModules = new ArrayList<>();

`

``

105

`+

private List selectedModules = new ArrayList<>();

`

106

106

``

107

107

`@Option(names = { "--o",

`

108

108

`"-select-module" }, arity = "1..*", converter = SelectorConverter.Module.class, hidden = true)

`

109

``

`-

private final List selectedModules2 = new ArrayList<>();

`

``

109

`+

private List selectedModules2 = new ArrayList<>();

`

110

110

``

111

111

`@Option(names = { "-p",

`

112

112

`"--select-package" }, paramLabel = "PKG", arity = "1..*", converter = SelectorConverter.Package.class, description = "Select a package for test discovery. This option can be repeated.")

`

113

``

`-

private final List selectedPackages = new ArrayList<>();

`

``

113

`+

private List selectedPackages = new ArrayList<>();

`

114

114

``

115

115

`@Option(names = { "--p",

`

116

116

`"-select-package" }, arity = "1..*", hidden = true, converter = SelectorConverter.Package.class)

`

117

``

`-

private final List selectedPackages2 = new ArrayList<>();

`

``

117

`+

private List selectedPackages2 = new ArrayList<>();

`

118

118

``

119

119

`@Option(names = { "-c",

`

120

120

`"--select-class" }, paramLabel = "CLASS", arity = "1..*", converter = SelectorConverter.Class.class, description = "Select a class for test discovery. This option can be repeated.")

`

121

``

`-

private final List selectedClasses = new ArrayList<>();

`

``

121

`+

private List selectedClasses = new ArrayList<>();

`

122

122

``

123

123

`@Option(names = { "--c",

`

124

124

`"-select-class" }, arity = "1..*", hidden = true, converter = SelectorConverter.Class.class)

`

125

``

`-

private final List selectedClasses2 = new ArrayList<>();

`

``

125

`+

private List selectedClasses2 = new ArrayList<>();

`

126

126

``

127

127

`@Option(names = { "-m",

`

128

128

`"--select-method" }, paramLabel = "NAME", arity = "1..*", converter = SelectorConverter.Method.class, description = "Select a method for test discovery. This option can be repeated.")

`

129

``

`-

private final List selectedMethods = new ArrayList<>();

`

``

129

`+

private List selectedMethods = new ArrayList<>();

`

130

130

``

131

131

`@Option(names = { "--m",

`

132

132

`"-select-method" }, arity = "1..*", hidden = true, converter = SelectorConverter.Method.class)

`

133

``

`-

private final List selectedMethods2 = new ArrayList<>();

`

``

133

`+

private List selectedMethods2 = new ArrayList<>();

`

134

134

``

135

135

`@Option(names = { "-r",

`

136

136

`"--select-resource" }, paramLabel = "RESOURCE", arity = "1..*", converter = SelectorConverter.ClasspathResource.class, description = "Select a classpath resource for test discovery. This option can be repeated.")

`

137

``

`-

private final List selectedClasspathResources = new ArrayList<>();

`

``

137

`+

private List selectedClasspathResources = new ArrayList<>();

`

138

138

``

139

139

`@Option(names = { "--r",

`

140

140

`"-select-resource" }, arity = "1..*", hidden = true, converter = SelectorConverter.ClasspathResource.class)

`

141

``

`-

private final List selectedClasspathResources2 = new ArrayList<>();

`

``

141

`+

private List selectedClasspathResources2 = new ArrayList<>();

`

142

142

``

143

143

`@Option(names = { "-i",

`

144

144

`"--select-iteration" }, paramLabel = "PREFIX:VALUE[INDEX(..INDEX)?(,INDEX(..INDEX)?)]", arity = "1..", converter = SelectorConverter.Iteration.class, //

`

145

145

`description = "Select iterations for test discovery via a prefixed identifier and a list of indexes or index ranges "

`

146

146

` + "(e.g. method:com.acme.Foo#m()[1..2] selects the first and second iteration of the m() method in the com.acme.Foo class). "

`

147

147

` + "This option can be repeated.")

`

148

``

`-

private final List selectedIterations = new ArrayList<>();

`

``

148

`+

private List selectedIterations = new ArrayList<>();

`

149

149

``

150

150

`@Option(names = { "--i",

`

151

151

`"-select-iteration" }, arity = "1..*", hidden = true, converter = SelectorConverter.Iteration.class)

`

152

``

`-

private final List selectedIterations2 = new ArrayList<>();

`

``

152

`+

private List selectedIterations2 = new ArrayList<>();

`

153

153

``

154

154

`@Option(names = { "--select-unique-id",

`

155

155

`"--uid" }, paramLabel = "UNIQUE-ID", arity = "1..*", converter = SelectorConverter.UniqueId.class, //

`

156

156

`description = "Select a unique id for test discovery. This option can be repeated.")

`

157

``

`-

private final List selectedUniqueIds = new ArrayList<>();

`

``

157

`+

private List selectedUniqueIds = new ArrayList<>();

`

158

158

``

159

159

`@Option(names = "--select", paramLabel = "PREFIX:VALUE", arity = "1..*", converter = SelectorConverter.Identifier.class, //

`

160

160

`description = "Select via a prefixed identifier (e.g. method:com.acme.Foo#m selects the m() method in the com.acme.Foo class). "

`

161

161

` + "This option can be repeated.")

`

162

``

`-

private final List selectorIdentifiers = new ArrayList<>();

`

``

162

`+

private List selectorIdentifiers = new ArrayList<>();

`

163

163

``

164

164

`SelectorOptions() {

`

165

165

` }

`

`@@ -191,74 +191,74 @@ public static class FilterOptions {

`

191

191

` + "names that begin with "Test" or end with "Test" or "Tests". " //

`

192

192

` + "When this option is repeated, all patterns will be combined using OR semantics. " //

`

193

193

` + "Default: ${DEFAULT-VALUE}")

`

194

``

`-

private final List includeClassNamePatterns = new ArrayList<>();

`

``

194

`+

private List includeClassNamePatterns = new ArrayList<>();

`

195

195

``

196

196

`@Option(names = { "--n", "-include-classname" }, arity = "1", hidden = true)

`

197

``

`-

private final List includeClassNamePatterns2 = new ArrayList<>();

`

``

197

`+

private List includeClassNamePatterns2 = new ArrayList<>();

`

198

198

``

199

199

`@Option(names = { "-N",

`

200

200

`"--exclude-classname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those classes whose fully qualified names match. " //

`

201

201

` + "When this option is repeated, all patterns will be combined using OR semantics.")

`

202

``

`-

private final List excludeClassNamePatterns = new ArrayList<>();

`

``

202

`+

private List excludeClassNamePatterns = new ArrayList<>();

`

203

203

``

204

204

`@Option(names = { "--N", "-exclude-classname" }, arity = "1", hidden = true)

`

205

``

`-

private final List excludeClassNamePatterns2 = new ArrayList<>();

`

``

205

`+

private List excludeClassNamePatterns2 = new ArrayList<>();

`

206

206

``

207

207

`@Option(names = {

`

208

208

`"--include-package" }, paramLabel = "PKG", arity = "1", description = "Provide a package to be included in the test run. This option can be repeated.")

`

209

``

`-

private final List includePackages = new ArrayList<>();

`

``

209

`+

private List includePackages = new ArrayList<>();

`

210

210

``

211

211

`@Option(names = { "-include-package" }, arity = "1", hidden = true)

`

212

``

`-

private final List includePackages2 = new ArrayList<>();

`

``

212

`+

private List includePackages2 = new ArrayList<>();

`

213

213

``

214

214

`@Option(names = {

`

215

215

`"--exclude-package" }, paramLabel = "PKG", arity = "1", description = "Provide a package to be excluded from the test run. This option can be repeated.")

`

216

``

`-

private final List excludePackages = new ArrayList<>();

`

``

216

`+

private List excludePackages = new ArrayList<>();

`

217

217

``

218

218

`@Option(names = { "-exclude-package" }, arity = "1", hidden = true)

`

219

``

`-

private final List excludePackages2 = new ArrayList<>();

`

``

219

`+

private List excludePackages2 = new ArrayList<>();

`

220

220

``

221

221

`@Option(names = {

`

222

222

`"--include-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to include only methods whose fully qualified names without parameters match. " //

`

223

223

` + "When this option is repeated, all patterns will be combined using OR semantics.")

`

224

``

`-

private final List includeMethodNamePatterns = new ArrayList<>();

`

``

224

`+

private List includeMethodNamePatterns = new ArrayList<>();

`

225

225

``

226

226

`@Option(names = {

`

227

227

`"--exclude-methodname" }, paramLabel = "PATTERN", arity = "1", description = "Provide a regular expression to exclude those methods whose fully qualified names without parameters match. " //

`

228

228

` + "When this option is repeated, all patterns will be combined using OR semantics.")

`

229

``

`-

private final List excludeMethodNamePatterns = new ArrayList<>();

`

``

229

`+

private List excludeMethodNamePatterns = new ArrayList<>();

`

230

230

``

231

231

`@Option(names = { "-t",

`

232

232

`"--include-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to include only tests whose tags match. "

`

233

233

` + //

`

234

234

`"When this option is repeated, all patterns will be combined using OR semantics.")

`

235

``

`-

private final List includedTags = new ArrayList<>();

`

``

235

`+

private List includedTags = new ArrayList<>();

`

236

236

``

237

237

`@Option(names = { "--t", "-include-tag" }, arity = "1", hidden = true)

`

238

``

`-

private final List includedTags2 = new ArrayList<>();

`

``

238

`+

private List includedTags2 = new ArrayList<>();

`

239

239

``

240

240

`@Option(names = { "-T",

`

241

241

`"--exclude-tag" }, paramLabel = "TAG", arity = "1", description = "Provide a tag or tag expression to exclude those tests whose tags match. "

`

242

242

` + //

`

243

243

`"When this option is repeated, all patterns will be combined using OR semantics.")

`

244

``

`-

private final List excludedTags = new ArrayList<>();

`

``

244

`+

private List excludedTags = new ArrayList<>();

`

245

245

``

246

246

`@Option(names = { "--T", "-exclude-tag" }, arity = "1", hidden = true)

`

247

``

`-

private final List excludedTags2 = new ArrayList<>();

`

``

247

`+

private List excludedTags2 = new ArrayList<>();

`

248

248

``

249

249

`@Option(names = { "-e",

`

250

250

`"--include-engine" }, paramLabel = "ID", arity = "1", description = "Provide the ID of an engine to be included in the test run. This option can be repeated.")

`

251

``

`-

private final List includedEngines = new ArrayList<>();

`

``

251

`+

private List includedEngines = new ArrayList<>();

`

252

252

``

253

253

`@Option(names = { "--e", "-include-engine" }, arity = "1", hidden = true)

`

254

``

`-

private final List includedEngines2 = new ArrayList<>();

`

``

254

`+

private List includedEngines2 = new ArrayList<>();

`

255

255

``

256

256

`@Option(names = { "-E",

`

257

257

`"--exclude-engine" }, paramLabel = "ID", arity = "1", description = "Provide the ID of an engine to be excluded from the test run. This option can be repeated.")

`

258

``

`-

private final List excludedEngines = new ArrayList<>();

`

``

258

`+

private List excludedEngines = new ArrayList<>();

`

259

259

``

260

260

`@Option(names = { "--E", "-exclude-engine" }, arity = "1", hidden = true)

`

261

``

`-

private final List excludedEngines2 = new ArrayList<>();

`

``

261

`+

private List excludedEngines2 = new ArrayList<>();

`

262

262

``

263

263

`private void applyTo(TestDiscoveryOptions result) {

`

264

264

`result.setIncludedClassNamePatterns(merge(this.includeClassNamePatterns, this.includeClassNamePatterns2));

`

`@@ -279,14 +279,14 @@ public static class RuntimeConfigurationOptions {

`

279

279

`@Option(names = { "-" + CP_OPTION, "--classpath",

`

280

280

`"--class-path" }, converter = ClasspathEntriesConverter.class, paramLabel = "PATH", arity = "1", description = "Provide additional classpath entries "

`

281

281

` + "-- for example, for adding engines and their dependencies. This option can be repeated.")

`

282

``

`-

private final List additionalClasspathEntries = new ArrayList<>();

`

``

282

`+

private List additionalClasspathEntries = new ArrayList<>();

`

283

283

``

284

284

`@Option(names = { "--cp", "-classpath",

`

285

285

`"-class-path" }, converter = ClasspathEntriesConverter.class, hidden = true)

`

286

``

`-

private final List additionalClasspathEntries2 = new ArrayList<>();

`

``

286

`+

private List additionalClasspathEntries2 = new ArrayList<>();

`

287

287

``

288

288

`// Implementation note: the @Option annotation is on a setter method to allow validation.

`

289

``

`-

private final Map<String, String> configurationParameters = new LinkedHashMap<>();

`

``

289

`+

private Map<String, String> configurationParameters = new LinkedHashMap<>();

`

290

290

``

291

291

`@Option(names = {

`

292

292

`"--config-resource" }, paramLabel = "PATH", arity = "1", description = "Set configuration parameters for test discovery and execution via a classpath resource. This option can be repeated.")

`