Add notFound suppor (& test) for assign REST (#1902)

Signed-off-by: Marinov Avgustin <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2024-10-17 17:06:08 +03:00
committed by GitHub
parent 60ee383158
commit 707df1abd9
6 changed files with 76 additions and 23 deletions

View File

@@ -206,8 +206,8 @@ public class DistributionSetTagManagementTest extends AbstractJpaIntegrationTest
assertThatThrownBy(() -> distributionSetManagement.assignTag(withMissing, tag.getId()))
.matches(e -> {
if (e instanceof EntityNotFoundException enfe) {
if (enfe.getType().equals(DistributionSet.class)) {
if (enfe.getEntityId() instanceof Collection entityId) {
if (enfe.getInfo().get(EntityNotFoundException.TYPE).equals(DistributionSet.class.getSimpleName())) {
if (enfe.getInfo().get(EntityNotFoundException.ENTITY_ID) instanceof Collection entityId) {
return entityId.stream().sorted().toList().equals(missing);
}
}

View File

@@ -202,8 +202,8 @@ class TargetTagManagementTest extends AbstractJpaIntegrationTest {
assertThatThrownBy(() -> targetManagement.assignTag(withMissing, tag.getId()))
.matches(e -> {
if (e instanceof EntityNotFoundException enfe) {
if (enfe.getType().equals(Target.class)) {
if (enfe.getEntityId() instanceof Collection entityId) {
if (enfe.getInfo().get(EntityNotFoundException.TYPE).equals(Target.class.getSimpleName())) {
if (enfe.getInfo().get(EntityNotFoundException.TYPE) instanceof Collection entityId) {
return entityId.stream().sorted().toList().equals(missing);
}
}