Merge "Fix simple sonar issues in models: errors to sim-pdp"
[policy/models.git] / models-provider / src / test / java / org / onap / policy / models / provider / impl / DatabasePolicyModelsProviderTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  *  Copyright (C) 2019 Nordix Foundation.
4  *  Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
5  * ================================================================================
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  * SPDX-License-Identifier: Apache-2.0
19  * ============LICENSE_END=========================================================
20  */
21
22 package org.onap.policy.models.provider.impl;
23
24 import static org.assertj.core.api.Assertions.assertThatThrownBy;
25 import static org.junit.Assert.assertEquals;
26 import static org.junit.Assert.assertNotNull;
27 import static org.junit.Assert.assertTrue;
28 import static org.junit.Assert.fail;
29
30 import java.util.ArrayList;
31 import java.util.Base64;
32 import java.util.List;
33
34 import org.junit.Before;
35 import org.junit.Test;
36 import org.onap.policy.models.pdp.concepts.Pdp;
37 import org.onap.policy.models.pdp.concepts.PdpGroup;
38 import org.onap.policy.models.pdp.concepts.PdpGroupFilter;
39 import org.onap.policy.models.pdp.concepts.PdpStatistics;
40 import org.onap.policy.models.pdp.concepts.PdpSubGroup;
41 import org.onap.policy.models.pdp.enums.PdpHealthStatus;
42 import org.onap.policy.models.pdp.enums.PdpState;
43 import org.onap.policy.models.provider.PolicyModelsProvider;
44 import org.onap.policy.models.provider.PolicyModelsProviderFactory;
45 import org.onap.policy.models.provider.PolicyModelsProviderParameters;
46 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyFilter;
47 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeFilter;
48 import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
49 import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
50 import org.onap.policy.models.tosca.legacy.concepts.LegacyGuardPolicyInput;
51 import org.onap.policy.models.tosca.legacy.concepts.LegacyOperationalPolicy;
52 import org.slf4j.Logger;
53 import org.slf4j.LoggerFactory;
54
55 /**
56  * Test the database models provider implementation.
57  *
58  * @author Liam Fallon (liam.fallon@est.tech)
59  */
60 public class DatabasePolicyModelsProviderTest {
61     private static final String NAME = "name";
62
63     private static final String TEMPLATE_IS_NULL = "serviceTemplate is marked @NonNull but is null";
64
65     private static final String POLICY_ID_IS_NULL = "policyId is marked @NonNull but is null";
66
67     private static final String PDP_TYPE_IS_NULL = "pdpType is marked @NonNull but is null";
68
69     private static final String SUBGROUP_IS_NULL = "pdpSubGroup is marked @NonNull but is null";
70
71     private static final String GROUP_IS_NULL = "pdpGroupName is marked @NonNull but is null";
72
73     private static final String NAME_IS_NULL = "name is marked @NonNull but is null";
74
75     private static final String FILTER_IS_NULL = "filter is marked @NonNull but is null";
76
77     private static final String INSTANCE = "Instance";
78
79     private static final String POLICY_ID = "policy_id";
80
81     private static final String GROUP = "group";
82
83     private static final String VERSION_100 = "1.0.0";
84
85     private static final Logger LOGGER = LoggerFactory.getLogger(DatabasePolicyModelsProviderTest.class);
86
87     PolicyModelsProviderParameters parameters;
88
89     /**
90      * Initialize parameters.
91      */
92     @Before
93     public void setupParameters() {
94         parameters = new PolicyModelsProviderParameters();
95         parameters.setDatabaseDriver("org.h2.Driver");
96         parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
97         parameters.setDatabaseUser("policy");
98         parameters.setDatabasePassword(Base64.getEncoder().encodeToString("P01icY".getBytes()));
99         parameters.setPersistenceUnit("ToscaConceptTest");
100     }
101
102     @Test
103     public void testInitAndClose() throws Exception {
104         assertThatThrownBy(() -> {
105             new DatabasePolicyModelsProviderImpl(null);
106         }).hasMessage("parameters is marked @NonNull but is null");
107
108         PolicyModelsProvider databaseProvider =
109                 new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
110
111         parameters.setDatabaseUrl("jdbc://www.acmecorp.nonexist");
112
113         databaseProvider.close();
114         databaseProvider.init();
115
116         databaseProvider.close();
117
118         parameters.setDatabaseUrl("jdbc:h2:mem:testdb");
119
120         parameters.setPersistenceUnit("WileECoyote");
121
122         assertThatThrownBy(databaseProvider::init).hasMessageContaining("could not create Data Access Object (DAO)");
123
124         parameters.setPersistenceUnit("ToscaConceptTest");
125
126         databaseProvider.init();
127         databaseProvider.close();
128
129         assertThatThrownBy(() -> {
130             databaseProvider.init();
131             databaseProvider.init();
132         }).hasMessage("provider is already initialized");
133
134         databaseProvider.close();
135
136         databaseProvider.close();
137     }
138
139     @Test
140     public void testProviderMethodsNull() throws Exception {
141
142         try (PolicyModelsProvider databaseProvider =
143                         new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters)) {
144
145             assertThatThrownBy(() -> {
146                 databaseProvider.getFilteredPolicyTypes(null);
147             }).hasMessage(FILTER_IS_NULL);
148
149             assertThatThrownBy(() -> {
150                 databaseProvider.getFilteredPolicyTypeList(null);
151             }).hasMessage(FILTER_IS_NULL);
152
153             assertThatThrownBy(() -> {
154                 databaseProvider.createPolicyTypes(null);
155             }).hasMessage(TEMPLATE_IS_NULL);
156
157             assertThatThrownBy(() -> {
158                 databaseProvider.updatePolicyTypes(null);
159             }).hasMessage(TEMPLATE_IS_NULL);
160
161             assertThatThrownBy(() -> {
162                 databaseProvider.deletePolicyType(null, null);
163             }).hasMessage(NAME_IS_NULL);
164
165             assertThatThrownBy(() -> {
166                 databaseProvider.deletePolicyType("aaa", null);
167             }).hasMessage("version is marked @NonNull but is null");
168
169             assertThatThrownBy(() -> {
170                 databaseProvider.deletePolicyType(null, "aaa");
171             }).hasMessage(NAME_IS_NULL);
172
173             assertThatThrownBy(() -> {
174                 databaseProvider.getFilteredPolicies(null);
175             }).hasMessage(FILTER_IS_NULL);
176
177             assertThatThrownBy(() -> {
178                 databaseProvider.getFilteredPolicyList(null);
179             }).hasMessage(FILTER_IS_NULL);
180
181             assertThatThrownBy(() -> {
182                 databaseProvider.createPolicies(null);
183             }).hasMessage(TEMPLATE_IS_NULL);
184
185             assertThatThrownBy(() -> {
186                 databaseProvider.updatePolicies(null);
187             }).hasMessage(TEMPLATE_IS_NULL);
188
189             assertThatThrownBy(() -> {
190                 databaseProvider.deletePolicy(null, null);
191             }).hasMessage(NAME_IS_NULL);
192
193             assertThatThrownBy(() -> {
194                 databaseProvider.deletePolicy(null, "aaa");
195             }).hasMessage(NAME_IS_NULL);
196
197             assertThatThrownBy(() -> {
198                 databaseProvider.deletePolicy("aaa", null);
199             }).hasMessage("version is marked @NonNull but is null");
200
201             assertThatThrownBy(() -> {
202                 databaseProvider.getOperationalPolicy(null, null);
203             }).hasMessage(POLICY_ID_IS_NULL);
204
205             assertThatThrownBy(() -> {
206                 databaseProvider.getOperationalPolicy(null, "");
207             }).hasMessage(POLICY_ID_IS_NULL);
208
209             assertThatThrownBy(() -> {
210                 databaseProvider.getOperationalPolicy("", null);
211             }).hasMessage("no policy found for policy: :null");
212
213             assertThatThrownBy(() -> {
214                 databaseProvider.createOperationalPolicy(null);
215             }).hasMessage("legacyOperationalPolicy is marked @NonNull but is null");
216
217             assertThatThrownBy(() -> {
218                 databaseProvider.updateOperationalPolicy(null);
219             }).hasMessage("legacyOperationalPolicy is marked @NonNull but is null");
220
221             assertThatThrownBy(() -> {
222                 databaseProvider.deleteOperationalPolicy(null, null);
223             }).hasMessage(POLICY_ID_IS_NULL);
224
225             assertThatThrownBy(() -> {
226                 databaseProvider.deleteOperationalPolicy(null, "");
227             }).hasMessage(POLICY_ID_IS_NULL);
228
229             assertThatThrownBy(() -> {
230                 databaseProvider.deleteOperationalPolicy("", null);
231             }).hasMessage("policyVersion is marked @NonNull but is null");
232
233             assertThatThrownBy(() -> {
234                 databaseProvider.getGuardPolicy(null, null);
235             }).hasMessage(POLICY_ID_IS_NULL);
236
237             assertThatThrownBy(() -> {
238                 databaseProvider.getGuardPolicy(null, "");
239             }).hasMessage(POLICY_ID_IS_NULL);
240
241             assertThatThrownBy(() -> {
242                 databaseProvider.getGuardPolicy("", null);
243             }).hasMessage("no policy found for policy: :null");
244
245             assertThatThrownBy(() -> {
246                 databaseProvider.createGuardPolicy(null);
247             }).hasMessage("legacyGuardPolicy is marked @NonNull but is null");
248
249             assertThatThrownBy(() -> {
250                 databaseProvider.updateGuardPolicy(null);
251             }).hasMessage("legacyGuardPolicy is marked @NonNull but is null");
252
253             assertThatThrownBy(() -> {
254                 databaseProvider.deleteGuardPolicy(null, null);
255             }).hasMessage(POLICY_ID_IS_NULL);
256
257             assertThatThrownBy(() -> {
258                 databaseProvider.deleteGuardPolicy(null, "");
259             }).hasMessage(POLICY_ID_IS_NULL);
260
261             assertThatThrownBy(() -> {
262                 databaseProvider.deleteGuardPolicy("", null);
263             }).hasMessage("policyVersion is marked @NonNull but is null");
264
265             assertThatThrownBy(() -> {
266                 databaseProvider.getFilteredPdpGroups(null);
267             }).hasMessage(FILTER_IS_NULL);
268
269             assertThatThrownBy(() -> {
270                 databaseProvider.createPdpGroups(null);
271             }).hasMessage("pdpGroups is marked @NonNull but is null");
272
273             assertThatThrownBy(() -> {
274                 databaseProvider.updatePdpGroups(null);
275             }).hasMessage("pdpGroups is marked @NonNull but is null");
276
277             assertThatThrownBy(() -> {
278                 databaseProvider.updatePdpSubGroup(null, null);
279             }).hasMessage(GROUP_IS_NULL);
280
281             assertThatThrownBy(() -> {
282                 databaseProvider.updatePdpSubGroup(null, new PdpSubGroup());
283             }).hasMessage(GROUP_IS_NULL);
284
285             assertThatThrownBy(() -> {
286                 databaseProvider.updatePdpSubGroup(NAME, null);
287             }).hasMessage(SUBGROUP_IS_NULL);
288
289             assertThatThrownBy(() -> {
290                 databaseProvider.updatePdpSubGroup(NAME, new PdpSubGroup());
291             }).hasMessage("parameter \"localName\" is null");
292
293             assertThatThrownBy(() -> {
294                 databaseProvider.updatePdp(null, null, null);
295             }).hasMessage(GROUP_IS_NULL);
296
297             assertThatThrownBy(() -> {
298                 databaseProvider.updatePdp(null, null, new Pdp());
299             }).hasMessage(GROUP_IS_NULL);
300
301             assertThatThrownBy(() -> {
302                 databaseProvider.updatePdp(null, "sub", null);
303             }).hasMessage(GROUP_IS_NULL);
304
305             assertThatThrownBy(() -> {
306                 databaseProvider.updatePdp(null, "sub", new Pdp());
307             }).hasMessage(GROUP_IS_NULL);
308
309             assertThatThrownBy(() -> {
310                 databaseProvider.updatePdp(NAME, null, null);
311             }).hasMessage(SUBGROUP_IS_NULL);
312
313             assertThatThrownBy(() -> {
314                 databaseProvider.updatePdp(NAME, null, new Pdp());
315             }).hasMessage(SUBGROUP_IS_NULL);
316
317             assertThatThrownBy(() -> {
318                 databaseProvider.updatePdp(NAME, "sub", null);
319             }).hasMessage("pdp is marked @NonNull but is null");
320
321             assertThatThrownBy(() -> {
322                 databaseProvider.updatePdp(NAME, "sub", new Pdp());
323             }).hasMessage("parameter \"localName\" is null");
324
325             assertThatThrownBy(() -> {
326                 databaseProvider.deletePdpGroup(null);
327             }).hasMessage(NAME_IS_NULL);
328
329             assertThatThrownBy(() -> {
330                 databaseProvider.updatePdpStatistics(null, null, null, null);
331             }).hasMessage(GROUP_IS_NULL);
332
333             assertThatThrownBy(() -> {
334                 databaseProvider.updatePdpStatistics(null, null, null, new PdpStatistics());
335             }).hasMessage(GROUP_IS_NULL);
336
337             assertThatThrownBy(() -> {
338                 databaseProvider.updatePdpStatistics(null, null, INSTANCE, null);
339             }).hasMessage(GROUP_IS_NULL);
340
341             assertThatThrownBy(() -> {
342                 databaseProvider.updatePdpStatistics(null, null, INSTANCE, new PdpStatistics());
343             }).hasMessage(GROUP_IS_NULL);
344
345             assertThatThrownBy(() -> {
346                 databaseProvider.updatePdpStatistics(null, "type", null, null);
347             }).hasMessage(GROUP_IS_NULL);
348
349             assertThatThrownBy(() -> {
350                 databaseProvider.updatePdpStatistics(null, "type", null, new PdpStatistics());
351             }).hasMessage(GROUP_IS_NULL);
352
353             assertThatThrownBy(() -> {
354                 databaseProvider.updatePdpStatistics(null, "type", INSTANCE, null);
355             }).hasMessage(GROUP_IS_NULL);
356
357             assertThatThrownBy(() -> {
358                 databaseProvider.updatePdpStatistics(null, "type", INSTANCE, new PdpStatistics());
359             }).hasMessage(GROUP_IS_NULL);
360
361             assertThatThrownBy(() -> {
362                 databaseProvider.updatePdpStatistics(NAME, null, null, null);
363             }).hasMessage(PDP_TYPE_IS_NULL);
364
365             assertThatThrownBy(() -> {
366                 databaseProvider.updatePdpStatistics(NAME, null, null, new PdpStatistics());
367             }).hasMessage(PDP_TYPE_IS_NULL);
368
369             assertThatThrownBy(() -> {
370                 databaseProvider.updatePdpStatistics(NAME, null, INSTANCE, null);
371             }).hasMessage(PDP_TYPE_IS_NULL);
372
373             assertThatThrownBy(() -> {
374                 databaseProvider.updatePdpStatistics(NAME, null, INSTANCE, new PdpStatistics());
375             }).hasMessage(PDP_TYPE_IS_NULL);
376
377             assertThatThrownBy(() -> {
378                 databaseProvider.updatePdpStatistics(NAME, "type", null, null);
379             }).hasMessage("pdpInstanceId is marked @NonNull but is null");
380
381             assertThatThrownBy(() -> {
382                 databaseProvider.updatePdpStatistics(NAME, "type", null, new PdpStatistics());
383             }).hasMessage("pdpInstanceId is marked @NonNull but is null");
384
385             assertThatThrownBy(() -> {
386                 databaseProvider.updatePdpStatistics(NAME, "type", INSTANCE, null);
387             }).hasMessage("pdpStatistics is marked @NonNull but is null");
388
389             databaseProvider.updatePdpStatistics(NAME, "type", INSTANCE, new PdpStatistics());
390         }
391     }
392
393     @Test
394     public void testProviderMethodsNotInit() throws Exception {
395         PolicyModelsProvider databaseProvider =
396                 new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters);
397
398         databaseProvider.close();
399
400         assertThatThrownBy(() -> {
401             databaseProvider.getPolicyTypes(NAME, "version");
402         }).hasMessage("policy models provider is not initilaized");
403     }
404
405     @Test
406     public void testProviderMethods() {
407         try (PolicyModelsProvider databaseProvider =
408                 new PolicyModelsProviderFactory().createPolicyModelsProvider(parameters)) {
409
410             assertTrue(databaseProvider.getPolicyTypes(NAME, VERSION_100).getPolicyTypes().isEmpty());
411             assertTrue(databaseProvider.getPolicyTypeList(NAME, VERSION_100).isEmpty());
412             assertEquals(0, databaseProvider.getFilteredPolicyTypes(ToscaPolicyTypeFilter.builder().build())
413                     .getPolicyTypes().size());
414             assertEquals(0, databaseProvider.getFilteredPolicyTypeList(ToscaPolicyTypeFilter.builder().build()).size());
415
416             assertThatThrownBy(() -> {
417                 databaseProvider.createPolicyTypes(new ToscaServiceTemplate());
418             }).hasMessage("no policy types specified on service template");
419
420             assertThatThrownBy(() -> {
421                 databaseProvider.updatePolicyTypes(new ToscaServiceTemplate());
422             }).hasMessage("no policy types specified on service template");
423
424             assertTrue(databaseProvider.deletePolicyType(NAME, VERSION_100).getPolicyTypes().isEmpty());
425
426             assertTrue(databaseProvider.deletePolicyType(NAME, VERSION_100).getPolicyTypes().isEmpty());
427
428             assertTrue(
429                     databaseProvider.getPolicies(NAME, VERSION_100).getToscaTopologyTemplate().getPolicies().isEmpty());
430             assertTrue(databaseProvider.getPolicyList(NAME, VERSION_100).isEmpty());
431             assertEquals(0, databaseProvider.getFilteredPolicies(ToscaPolicyFilter.builder().build())
432                     .getToscaTopologyTemplate().getPolicies().size());
433             assertEquals(0, databaseProvider.getFilteredPolicyList(ToscaPolicyFilter.builder().build()).size());
434
435             assertThatThrownBy(() -> {
436                 databaseProvider.createPolicies(new ToscaServiceTemplate());
437             }).hasMessage("topology template not specified on service template");
438
439             assertThatThrownBy(() -> {
440                 databaseProvider.updatePolicies(new ToscaServiceTemplate());
441             }).hasMessage("topology template not specified on service template");
442
443             assertTrue(databaseProvider.deletePolicy("Policy", "0.0.0").getToscaTopologyTemplate().getPolicies()
444                     .isEmpty());
445
446             assertThatThrownBy(() -> {
447                 databaseProvider.getOperationalPolicy(POLICY_ID, null);
448             }).hasMessage("no policy found for policy: policy_id:null");
449
450             assertThatThrownBy(() -> {
451                 databaseProvider.getOperationalPolicy(POLICY_ID, "10");
452             }).hasMessage("no policy found for policy: policy_id:10");
453
454             assertThatThrownBy(() -> {
455                 databaseProvider.createOperationalPolicy(new LegacyOperationalPolicy());
456             }).hasMessage(NAME_IS_NULL);
457
458             assertThatThrownBy(() -> {
459                 databaseProvider.updateOperationalPolicy(new LegacyOperationalPolicy());
460             }).hasMessage(NAME_IS_NULL);
461
462             assertThatThrownBy(() -> {
463                 databaseProvider.deleteOperationalPolicy(POLICY_ID, "55");
464             }).hasMessage("no policy found for policy: policy_id:55");
465
466             assertThatThrownBy(() -> {
467                 databaseProvider.getGuardPolicy(POLICY_ID, null);
468             }).hasMessage("no policy found for policy: policy_id:null");
469
470             assertThatThrownBy(() -> {
471                 databaseProvider.getGuardPolicy(POLICY_ID, "6");
472             }).hasMessage("no policy found for policy: policy_id:6");
473
474             assertThatThrownBy(() -> {
475                 databaseProvider.createGuardPolicy(new LegacyGuardPolicyInput());
476             }).hasMessage("policy type for guard policy \"null\" unknown");
477
478             assertThatThrownBy(() -> {
479                 databaseProvider.updateGuardPolicy(new LegacyGuardPolicyInput());
480             }).hasMessage("policy type for guard policy \"null\" unknown");
481
482             assertThatThrownBy(() -> {
483                 databaseProvider.deleteGuardPolicy(POLICY_ID, "33");
484             }).hasMessage("no policy found for policy: policy_id:33");
485
486             assertEquals(0, databaseProvider.getPdpGroups(NAME).size());
487             assertEquals(0, databaseProvider.getFilteredPdpGroups(PdpGroupFilter.builder().build()).size());
488
489             assertNotNull(databaseProvider.createPdpGroups(new ArrayList<>()));
490             assertNotNull(databaseProvider.updatePdpGroups(new ArrayList<>()));
491
492             PdpGroup pdpGroup = new PdpGroup();
493             pdpGroup.setName(GROUP);
494             pdpGroup.setVersion("1.2.3");
495             pdpGroup.setPdpGroupState(PdpState.ACTIVE);
496             pdpGroup.setPdpSubgroups(new ArrayList<>());
497             List<PdpGroup> groupList = new ArrayList<>();
498             groupList.add(pdpGroup);
499
500             PdpSubGroup pdpSubGroup = new PdpSubGroup();
501             pdpSubGroup.setPdpType("type");
502             pdpSubGroup.setDesiredInstanceCount(123);
503             pdpSubGroup.setSupportedPolicyTypes(new ArrayList<>());
504             pdpSubGroup.getSupportedPolicyTypes().add(new ToscaPolicyTypeIdentifier("type", "7.8.9"));
505             pdpGroup.getPdpSubgroups().add(pdpSubGroup);
506
507             Pdp pdp = new Pdp();
508             pdp.setInstanceId("type-0");
509             pdp.setMessage("Hello");
510             pdp.setPdpState(PdpState.ACTIVE);
511             pdp.setHealthy(PdpHealthStatus.UNKNOWN);
512             pdpSubGroup.setPdpInstances(new ArrayList<>());
513             pdpSubGroup.getPdpInstances().add(pdp);
514
515             assertEquals(123, databaseProvider.createPdpGroups(groupList).get(0).getPdpSubgroups().get(0)
516                     .getDesiredInstanceCount());
517             assertEquals(1, databaseProvider.getPdpGroups(GROUP).size());
518
519             pdpSubGroup.setDesiredInstanceCount(234);
520             databaseProvider.updatePdpSubGroup(GROUP, pdpSubGroup);
521             assertEquals(234, databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups()
522                     .get(0).getDesiredInstanceCount());
523
524             assertEquals("Hello", databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups()
525                     .get(0).getPdpInstances().get(0).getMessage());
526             pdp.setMessage("Howdy");
527             databaseProvider.updatePdp(GROUP, "type", pdp);
528             assertEquals("Howdy", databaseProvider.getPdpGroups(GROUP).get(0).getPdpSubgroups()
529                     .get(0).getPdpInstances().get(0).getMessage());
530
531             assertThatThrownBy(() -> {
532                 databaseProvider.deletePdpGroup(NAME);
533             }).hasMessage("delete of PDP group \"name:0.0.0\" failed, PDP group does not exist");
534
535             assertEquals(pdpGroup.getName(), databaseProvider.deletePdpGroup(GROUP).getName());
536
537             assertEquals(0, databaseProvider.getPdpStatistics(null).size());
538
539             databaseProvider.updatePdpStatistics(GROUP, "type", "type-0", new PdpStatistics());
540         } catch (Exception exc) {
541             LOGGER.warn("test should not throw an exception", exc);
542             fail("test should not throw an exception");
543         }
544     }
545 }