/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019-2020 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
*/
public class JpaToscaModelTest {
- private static final String KEY_IS_NULL = "key is marked @NonNull but is null";
+ private static final String KEY_IS_NULL = "key is marked .*on.*ull but is null";
private static final String VERSION_001 = "0.0.1";
@Test
assertNotNull(new JpaToscaModel(new PfConceptKey(), new JpaToscaServiceTemplates()));
assertNotNull(new JpaToscaModel(new JpaToscaModel()));
- assertThatThrownBy(() -> new JpaToscaModel((PfConceptKey) null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaModel((PfConceptKey) null)).hasMessageMatching(KEY_IS_NULL);
- assertThatThrownBy(() -> new JpaToscaModel(null, null)).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaModel(null, null)).hasMessageMatching(KEY_IS_NULL);
- assertThatThrownBy(() -> new JpaToscaModel(null, new JpaToscaServiceTemplates())).hasMessage(KEY_IS_NULL);
+ assertThatThrownBy(() -> new JpaToscaModel(null, new JpaToscaServiceTemplates()))
+ .hasMessageMatching(KEY_IS_NULL);
assertThatThrownBy(() -> new JpaToscaModel(new PfConceptKey(), null))
- .hasMessage("serviceTemplates is marked @NonNull but is null");
+ .hasMessageMatching("serviceTemplates is marked .*on.*ull but is null");
assertThatThrownBy(() -> new JpaToscaModel((JpaToscaModel) null))
- .hasMessage("copyConcept is marked @NonNull but is null");
+ .hasMessageMatching("copyConcept is marked .*on.*ull but is null");
PfConceptKey tstsKey = new PfConceptKey("tsts", VERSION_001);
Map<PfConceptKey, JpaToscaServiceTemplate> tstMap = new TreeMap<>();
otherDt.setServiceTemplates(tsts);
assertEquals(0, tm.compareTo(otherDt));
- assertThatThrownBy(() -> new JpaToscaModel((JpaToscaModel) null))
- .isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new JpaToscaModel((JpaToscaModel) null)).isInstanceOf(NullPointerException.class);
assertEquals(2, tm.getKeys().size());
assertEquals(2, new JpaToscaModel().getKeys().size());
assertEquals(tttClone0, tm);
assertFalse(new JpaToscaModel().validate(new PfValidationResult()).isValid());
- assertFalse(tm.validate(new PfValidationResult()).isValid());
+ assertTrue(tm.validate(new PfValidationResult()).isValid());
tm.register();
assertTrue(PfModelService.existsModel(tm.getServiceTemplates().getId()));
PfModelService.deregisterModel(tm.getServiceTemplates().getId());
- assertThatThrownBy(() -> tm.validate(null)).hasMessage("resultIn is marked @NonNull but is null");
+ assertThatThrownBy(() -> tm.validate(null)).hasMessageMatching("resultIn is marked .*on.*ull but is null");
}
}