tkdwlsdlzzz1820
@tkdwlsdlzzz1820
Reviews Written
1
Average Rating
5.0
Posts
Q&A
JunitParams ๊ด๋ จ ์ง๋ฌธ ๋๋ฆฝ๋๋ค.
Junit5๋ก ํ ๋๋ ๋ฐฉ๋ฒ์ด ์กฐ๊ธ ๋ฐ๋์์ต๋๋ค. org.junit.jupiter junit-jupiter-params 5.4.2 test @ParameterizedTest@CsvSource({ "0, 0, true", "0, 100, false", "100, 0, false",})public void testFree(int basePrice, int maxPrice, boolean isFree) { Event event = Event.builder() .basePrice(basePrice) .maxPrice(maxPrice) .build(); event.update(); assertThat(event.isFree()).isEqualTo(isFree);}@ParameterizedTest@MethodSource("isOffline")public void testOffline(String location, boolean isOffline) { Event event = Event.builder() .location(location) .build(); event.update(); assertThat(event.isOffline()).isEqualTo(isOffline);}private static Stream isOffline() { return Stream.of( Arguments.of("๊ฐ๋จ์ญ", true), Arguments.of(null, false), Arguments.of("", false) );}
- 3
- 3
- 6.5K
Q&A
์์ ์๋ฌ ์ง๋ฌธ ๋๋ฆฝ๋๋ค.
์ด๋ ธํ ์ด์ ๋ถ์ด๊ณ ์์๋ ๋ฐ์๋๋ฐ ์ด๋ฐ ์๋ฌ๊ฐ ๋ฐ์ํฉ๋๋ค. ํน์ ์คํ๋ง๋ถํธ 2.1.2 ๋ฒ์ ์ ์ฌ์ฉํด์ ๊ฐ์์์ ์ฌ์ฉํ๋ ๋ฒ์ ๊ณผ ๋ฌ๋ผ์์ผ๊น์? ์๋๋ฉด ์ ๊ฐ DB๋ก mysql์ ์ฐ๊ฒฐํด์ ์ฐ๊ณ ์์ด์ ๊ทธ๋ด๊น์? ์ ์ฒด์ฝ๋์ ๋๋ค import naver.sangjin.demoinfleanrestapi.accounts.AccountService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.security.servlet.PathRequest; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.WebSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.oauth2.provider.token.TokenStore; import org.springframework.security.oauth2.provider.token.store.InMemoryTokenStore; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired AccountService accountService; @Autowired PasswordEncoder passwordEncoder; @Bean public TokenStore tokenStore() { return new InMemoryTokenStore(); } @Bean @Override public AuthenticationManager authenticationManagerBean() throws Exception { return super.authenticationManagerBean(); } @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.userDetailsService(accountService) .passwordEncoder(passwordEncoder); } @Override public void configure(WebSecurity web) throws Exception { web.ignoring().mvcMatchers("/docs/index.html"); web.ignoring().requestMatchers(PathRequest.toStaticResources().atCommonLocations()); } }
- 0
- 2
- 2.1K
Q&A
์์ค์ฝ๋ ์๋ฌ
์ ์ ๊ฐ ์์ ๋ฃ๊ธฐ์ ์ ์์ค์ฝ๋๋ง ์ด์ด๋ด์ ๋นํฉํ๋ค์ ์ ์ฃผํ ์์ํ๊ฒ ์ต๋๋ค!!
- 0
- 2
- 263




