Debian Codegraph @

src/test/java/ezvcard/property/asserter/AddressAsserter.java

raw symbols SCIP
1 package ezvcard.property.asserter;
2
3 import static java.util.Arrays.asList;
4
5 import java.util.List;
6
7 import ezvcard.parameter.AddressType;
8 import ezvcard.property.Address;
9
10 /*
11 Copyright (c) 2012-2023, Michael Angstadt
12 All rights reserved.
13
14 Redistribution and use in source and binary forms, with or without
15 modification, are permitted provided that the following conditions are met:
16
17 1. Redistributions of source code must retain the above copyright notice, this
18 list of conditions and the following disclaimer.
19 2. Redistributions in binary form must reproduce the above copyright notice,
20 this list of conditions and the following disclaimer in the documentation
21 and/or other materials provided with the distribution.
22
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
26 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
27 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
29 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 The views and conclusions contained in the software and documentation are those
35 of the authors and should not be interpreted as representing official policies,
36 either expressed or implied, of the FreeBSD Project.
37 */
38
39 /**
40 * @author Michael Angstadt
41 */
42 public class AddressAsserter extends PropertyImplAsserter<AddressAsserter, Address> {
43 public AddressAsserter(List<Address> properties, VCardAsserter asserter) {
44 super(properties, asserter);
45 }
46
47 public AddressAsserter poBox(String poBox) {
48 expected.setPoBox(poBox);
49 return this_;
50 }
51
52 public AddressAsserter extendedAddress(String extendedAddress) {
53 expected.setExtendedAddress(extendedAddress);
54 return this_;
55 }
56
57 public AddressAsserter streetAddress(String... streetAddress) {
58 expected.getStreetAddresses().addAll(asList(streetAddress));
59 return this_;
60 }
61
62 public AddressAsserter locality(String locality) {
63 expected.setLocality(locality);
64 return this_;
65 }
66
67 public AddressAsserter region(String region) {
68 expected.setRegion(region);
69 return this_;
70 }
71
72 public AddressAsserter postalCode(String postalCode) {
73 expected.setPostalCode(postalCode);
74 return this_;
75 }
76
77 public AddressAsserter country(String country) {
78 expected.setCountry(country);
79 return this_;
80 }
81
82 public AddressAsserter label(String label) {
83 expected.setLabel(label);
84 return this_;
85 }
86
87 public AddressAsserter types(AddressType... types) {
88 expected.getTypes().addAll(asList(types));
89 return this_;
90 }
91
92 @Override
93 protected Address _newInstance() {
94 return new Address();
95 }
96 }