@@ -63,23 +63,17 @@ public static void assertDefaultKeys(final Map<String, StringLookup> stringLooku
6363
6464 private static void assertMappedLookups (final Map <String , StringLookup > lookupMap , final String ... keys ) {
6565 final Set <String > remainingKeys = new HashSet <>(lookupMap .keySet ());
66-
6766 for (final String key : keys ) {
6867 final String normalizedKey = StringLookupFactory .toKey (key );
6968 assertNotNull (normalizedKey , () -> "Expected map to contain string lookup for key " + key );
70-
7169 remainingKeys .remove (normalizedKey );
7270 }
73-
7471 assertTrue (remainingKeys .isEmpty (), () -> "Unexpected keys in lookup map: " + remainingKeys );
7572 }
7673
7774 private static void checkDefaultStringLookupsHolder (final Properties props , final String ... keys ) {
78- final StringLookupFactory .DefaultStringLookupsHolder holder =
79- new StringLookupFactory .DefaultStringLookupsHolder (props );
80-
75+ final StringLookupFactory .DefaultStringLookupsHolder holder = new StringLookupFactory .DefaultStringLookupsHolder (props );
8176 final Map <String , StringLookup > lookupMap = holder .getDefaultStringLookups ();
82-
8377 assertMappedLookups (lookupMap , keys );
8478 }
8579
@@ -90,7 +84,6 @@ private static void checkDefaultStringLookupsHolder(final Properties props, fina
9084 public static void main (final String [] args ) {
9185 final Map <String , StringLookup > lookupMap = new HashMap <>();
9286 StringLookupFactory .INSTANCE .addDefaultStringLookups (lookupMap );
93-
9487 System .out .println ("Default string lookups" );
9588 for (final String key : lookupMap .keySet ()) {
9689 System .out .println ("- " + key );
@@ -139,11 +132,9 @@ void testDefault() {
139132 @ Test
140133 void testDefaultStringLookupsHolder_allLookups () {
141134 final Properties props = new Properties ();
142- props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY ,
143- "BASE64_DECODER BASE64_ENCODER const, date, dns, environment "
144- + "file ,java, local_host properties, resource_bundle,script,system_properties "
145- + "url url_decoder , url_encoder, xml" );
146-
135+ props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , "BASE64_DECODER BASE64_ENCODER const, date, dns, environment "
136+ + "file ,java, local_host properties, resource_bundle,script,system_properties url url_decoder , url_encoder, xml" );
137+ // @formatter:off
147138 checkDefaultStringLookupsHolder (props ,
148139 "base64" ,
149140 StringLookupFactory .KEY_BASE64_DECODER ,
@@ -165,51 +156,44 @@ void testDefaultStringLookupsHolder_allLookups() {
165156 StringLookupFactory .KEY_DNS ,
166157 StringLookupFactory .KEY_URL ,
167158 StringLookupFactory .KEY_SCRIPT );
159+ // @formatter:on
168160 }
169161
170162 @ Test
171163 void testDefaultStringLookupsHolder_givenSingleLookup () {
172164 final Properties props = new Properties ();
173165 props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , "base64_encoder" );
174-
175- checkDefaultStringLookupsHolder (props ,
176- "base64" ,
177- StringLookupFactory .KEY_BASE64_ENCODER );
166+ checkDefaultStringLookupsHolder (props , "base64" , StringLookupFactory .KEY_BASE64_ENCODER );
178167 }
179168
180169 @ Test
181170 void testDefaultStringLookupsHolder_givenSingleLookup_weirdString () {
182171 final Properties props = new Properties ();
183172 props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , " \n \t ,, DnS , , " );
184-
185173 checkDefaultStringLookupsHolder (props , StringLookupFactory .KEY_DNS );
186174 }
187175
188176 @ Test
189177 void testDefaultStringLookupsHolder_invalidLookupsDefinition () {
190178 final Properties props = new Properties ();
191179 props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , "base64_encoder nope" );
192-
193- final Exception exc = assertThrows (IllegalArgumentException .class ,
194- () -> new StringLookupFactory .DefaultStringLookupsHolder (props ));
180+ final Exception exc = assertThrows (IllegalArgumentException .class , () -> new StringLookupFactory .DefaultStringLookupsHolder (props ));
195181 assertEquals ("Invalid default string lookups definition: base64_encoder nope" , exc .getMessage ());
196182 }
197183
198184 @ Test
199185 void testDefaultStringLookupsHolder_lookupsPropertyEmptyAndBlank () {
200186 final Properties propsWithNull = new Properties ();
201187 propsWithNull .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , "" );
202-
203188 checkDefaultStringLookupsHolder (propsWithNull );
204-
205189 final Properties propsWithBlank = new Properties ();
206190 propsWithBlank .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , " " );
207-
208191 checkDefaultStringLookupsHolder (propsWithBlank );
209192 }
210193
211194 @ Test
212195 void testDefaultStringLookupsHolder_lookupsPropertyNotPresent () {
196+ // @formatter:off
213197 checkDefaultStringLookupsHolder (new Properties (),
214198 "base64" ,
215199 StringLookupFactory .KEY_BASE64_DECODER ,
@@ -229,17 +213,19 @@ void testDefaultStringLookupsHolder_lookupsPropertyNotPresent() {
229213 StringLookupFactory .KEY_XML ,
230214 StringLookupFactory .KEY_XML_DECODER ,
231215 StringLookupFactory .KEY_XML_ENCODER );
216+ // @formatter:on
232217 }
233218
234219 @ Test
235220 void testDefaultStringLookupsHolder_multipleLookups () {
236221 final Properties props = new Properties ();
237222 props .setProperty (StringLookupFactory .DEFAULT_STRING_LOOKUPS_PROPERTY , "dns, url script " );
238-
223+ // @formatter:off
239224 checkDefaultStringLookupsHolder (props ,
240225 StringLookupFactory .KEY_DNS ,
241226 StringLookupFactory .KEY_URL ,
242227 StringLookupFactory .KEY_SCRIPT );
228+ // @formatter:on
243229 }
244230
245231 /**
@@ -248,24 +234,20 @@ void testDefaultStringLookupsHolder_multipleLookups() {
248234 @ Test
249235 void testSingletons () {
250236 final StringLookupFactory stringLookupFactory = StringLookupFactory .INSTANCE ;
251- assertSame (StringLookupFactory .INSTANCE_BASE64_DECODER ,
252- stringLookupFactory .base64DecoderStringLookup ());
253- assertSame (StringLookupFactory .INSTANCE_BASE64_ENCODER ,
254- stringLookupFactory .base64EncoderStringLookup ());
237+ assertSame (StringLookupFactory .INSTANCE_BASE64_DECODER , stringLookupFactory .base64DecoderStringLookup ());
238+ assertSame (StringLookupFactory .INSTANCE_BASE64_ENCODER , stringLookupFactory .base64EncoderStringLookup ());
255239 assertSame (ConstantStringLookup .INSTANCE , stringLookupFactory .constantStringLookup ());
256240 assertSame (DateStringLookup .INSTANCE , stringLookupFactory .dateStringLookup ());
257241 assertSame (DnsStringLookup .INSTANCE , stringLookupFactory .dnsStringLookup ());
258- assertSame (StringLookupFactory .INSTANCE_ENVIRONMENT_VARIABLES ,
259- stringLookupFactory .environmentVariableStringLookup ());
242+ assertSame (StringLookupFactory .INSTANCE_ENVIRONMENT_VARIABLES , stringLookupFactory .environmentVariableStringLookup ());
260243 assertSame (InterpolatorStringLookup .INSTANCE , stringLookupFactory .interpolatorStringLookup ());
261244 assertSame (JavaPlatformStringLookup .INSTANCE , stringLookupFactory .javaPlatformStringLookup ());
262245 assertSame (InetAddressStringLookup .LOCAL_HOST , stringLookupFactory .localHostStringLookup ());
263246 assertSame (InetAddressStringLookup .LOOPACK_ADDRESS , stringLookupFactory .loopbackAddressStringLookup ());
264247 assertSame (StringLookupFactory .INSTANCE_NULL , stringLookupFactory .nullStringLookup ());
265248 assertSame (ResourceBundleStringLookup .INSTANCE , stringLookupFactory .resourceBundleStringLookup ());
266249 assertSame (ScriptStringLookup .INSTANCE , stringLookupFactory .scriptStringLookup ());
267- assertSame (StringLookupFactory .INSTANCE_SYSTEM_PROPERTIES ,
268- stringLookupFactory .systemPropertyStringLookup ());
250+ assertSame (StringLookupFactory .INSTANCE_SYSTEM_PROPERTIES , stringLookupFactory .systemPropertyStringLookup ());
269251 assertSame (UrlDecoderStringLookup .INSTANCE , stringLookupFactory .urlDecoderStringLookup ());
270252 assertSame (UrlEncoderStringLookup .INSTANCE , stringLookupFactory .urlEncoderStringLookup ());
271253 assertSame (UrlStringLookup .INSTANCE , stringLookupFactory .urlStringLookup ());
0 commit comments