import java.util.Set;
import org.junit.Assert;
+import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.onap.portalsdk.core.onboarding.exception.PortalAPIException;
import org.onap.portalsdk.core.restful.domain.EcompRole;
EcompUser user = createEcompUser(loginId);
dum.createUser(user);
logger.info("Created user {}", user);
- try {
+ Assertions.assertThrows(PortalAPIException.class, () -> {
dum.createUser(user);
- throw new Exception("Unexpected success");
- } catch (PortalAPIException ex) {
- logger.info("caught expected exception: {}", ex.toString());
- }
+ });
Assert.assertFalse(dum.getUsers().isEmpty());
EcompUser fetched = dum.getUser(loginId);
Assert.assertEquals(fetched, user);
EcompUser missing = dum.getUser("foo");
Assert.assertNull(missing);
EcompUser unk = createEcompUser("unknown");
- try {
+ Assertions.assertThrows(PortalAPIException.class, () -> {
dum.updateUser("unk", unk);
- } catch (PortalAPIException ex) {
- logger.info("caught expected exception: {}", ex.toString());
- }
+ });
}
}