use of tech.jhipster.config.JHipsterProperties in project ArTEMiS by ls1intum.
the class TokenProviderTest method testKeyIsSetFromSecretWhenSecretIsNotEmpty.
@Test
void testKeyIsSetFromSecretWhenSecretIsNotEmpty() {
final String secret = "NwskoUmKHZtzGRKJKVjsJF7BtQMMxNWi";
JHipsterProperties jHipsterProperties = new JHipsterProperties();
jHipsterProperties.getSecurity().getAuthentication().getJwt().setSecret(secret);
SecurityMetersService securityMetersService = new SecurityMetersService(new SimpleMeterRegistry());
TokenProvider tokenProvider = new TokenProvider(jHipsterProperties, securityMetersService);
tokenProvider.init();
Key key = (Key) ReflectionTestUtils.getField(tokenProvider, "key");
assertThat(key).isNotNull().isEqualTo(Keys.hmacShaKeyFor(secret.getBytes(StandardCharsets.UTF_8)));
}
use of tech.jhipster.config.JHipsterProperties in project ArTEMiS by ls1intum.
the class MailServiceTest method setUp.
/**
* Prepares the needed values and objects for testing
*/
@BeforeEach
public void setUp() {
student1 = new User();
student1.setId(555L);
String EMAIL_ADDRESS_A = "benige8246@omibrown.com";
student1.setEmail(EMAIL_ADDRESS_A);
subject = "subject";
content = "content";
mimeMessage = mock(MimeMessage.class);
javaMailSender = mock(JavaMailSender.class);
when(javaMailSender.createMimeMessage()).thenReturn(mimeMessage);
mail = mock(JHipsterProperties.Mail.class);
String EMAIL_ADDRESS_B = "alex2713@gmail.com";
when(mail.getFrom()).thenReturn(EMAIL_ADDRESS_B);
jHipsterProperties = mock(JHipsterProperties.class);
when(jHipsterProperties.getMail()).thenReturn(mail);
mailService = new MailService(jHipsterProperties, javaMailSender, messageSource, templateEngine, timeService);
}
use of tech.jhipster.config.JHipsterProperties in project auth0-full-stack-java-example by oktadev.
the class StaticResourcesWebConfigurerTest method setUp.
@BeforeEach
void setUp() {
servletContext = spy(new MockServletContext());
applicationContext = mock(WebApplicationContext.class);
resourceHandlerRegistry = spy(new ResourceHandlerRegistry(applicationContext, servletContext));
props = new JHipsterProperties();
staticResourcesWebConfiguration = spy(new StaticResourcesWebConfiguration(props));
}
use of tech.jhipster.config.JHipsterProperties in project auth0-full-stack-java-example by oktadev.
the class WebConfigurerTest method setup.
@BeforeEach
public void setup() {
servletContext = spy(new MockServletContext());
doReturn(mock(FilterRegistration.Dynamic.class)).when(servletContext).addFilter(anyString(), any(Filter.class));
doReturn(mock(ServletRegistration.Dynamic.class)).when(servletContext).addServlet(anyString(), any(Servlet.class));
env = new MockEnvironment();
props = new JHipsterProperties();
webConfigurer = new WebConfigurer(env, props);
}
Aggregations