1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.creadur.whisker.model;
20
21 import java.util.Collection;
22 import java.util.Collections;
23
24 public class LicenseBuilderForTesting {
25
26 private static final String DEFAULT_PRIMARY_TEXT = "License text for the primary license.";
27 public static final String DEFAULT_PRIMARY_URL = "http://primary.example.org";
28 public static final String DEFAULT_PRIMARY_NAME = "Primary License";
29 public static final String DEFAULT_PRIMARY_ID = "primary.example.org";
30 public static final String DEFAULT_NAME = "Example License";
31 public static final String DEFAULT_URL = "http://example.org";
32 public static final String DEFAULT_ID = "example.org";
33 public static final String DEFAULT_LICENSE_TEXT = "This is the license text";
34
35 public static License defaultPrimaryLicense() {
36 return new LicenseBuilderForTesting()
37 .withId(DEFAULT_PRIMARY_ID)
38 .withName(DEFAULT_PRIMARY_NAME)
39 .withUrl(DEFAULT_PRIMARY_URL)
40 .withText(DEFAULT_PRIMARY_TEXT)
41 .build();
42 }
43
44 boolean isSourceRequired = false;
45 String baseText = DEFAULT_LICENSE_TEXT;
46 Collection<String> expectedParameters = Collections.<String> emptyList();
47 String id = DEFAULT_ID;
48 String url = DEFAULT_URL;
49 String name = DEFAULT_NAME;
50
51 public License build() {
52 return new License(isSourceRequired, baseText, expectedParameters, id, url, name);
53 }
54
55 public LicenseBuilderForTesting withId(String id) {
56 this.id = id;
57 return this;
58 }
59
60 public LicenseBuilderForTesting withUrl(String url) {
61 this.url = url;
62 return this;
63 }
64
65 public LicenseBuilderForTesting withName(String name) {
66 this.name = name;
67 return this;
68 }
69
70 public LicenseBuilderForTesting withText(String baseText) {
71 this.baseText = baseText;
72 return this;
73 }
74 }