junit5: BaseOAuth2ConfigTemplateServiceTest annotation exceptions refactoring

This commit is contained in:
Oleksandra Matviienko 2023-03-06 13:55:41 +01:00
parent 84e4c8f231
commit 1fb9ddc1db

View File

@ -19,6 +19,7 @@ import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.Assertions;
import org.springframework.beans.factory.annotation.Autowired;
import org.thingsboard.server.common.data.id.TenantId;
import org.thingsboard.server.common.data.oauth2.MapperType;
@ -51,12 +52,14 @@ public abstract class BaseOAuth2ConfigTemplateServiceTest extends AbstractServic
}
@Test(expected = DataValidationException.class)
@Test
public void testSaveDuplicateProviderId() {
OAuth2ClientRegistrationTemplate first = validClientRegistrationTemplate("providerId");
OAuth2ClientRegistrationTemplate second = validClientRegistrationTemplate("providerId");
oAuth2ConfigTemplateService.saveClientRegistrationTemplate(first);
Assertions.assertThrows(DataValidationException.class, () -> {
oAuth2ConfigTemplateService.saveClientRegistrationTemplate(second);
});
}
@Test