This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Divider { | |
public int divide(int dividend, int divisor) { | |
if (divisor == null) { | |
throw new IllegalArgumentException("divisor must not be null"); | |
} | |
if (dividend == null) { | |
throw new IllegalArgumentException("dividend must not be null"); | |
} | |
if (divisor == 0) { | |
throw new IllegalArgumentException("divisor must not be 0"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Divider { | |
public int divide(int dividend, int divisor) { | |
if (divisor != null) { | |
if(dividend != null) { | |
if (divisor != 0) { | |
return dividend / divisor; | |
} else { | |
throw new IllegalArgumentException("divisor must not be 0"); | |
} | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Divider { | |
public int divide(int dividend, int divisor) { | |
return dividend / divisor; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { calc, search } from '@/pages/goodsList/search'; | |
describe('search api', () => { | |
it('search api를 호출한다.', async () => { | |
const { data } = await search({ keyword: 'blackpink' }); | |
// console.log(data); | |
expect(data).toMatchSnapshot(); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
class CorsConfiguration { | |
@Bean | |
WebMvcConfigurer corsConfigurer() { | |
return new WebMvcConfigurer() { | |
@Override | |
public void addCorsMappings(final CorsRegistry registry) { | |
registry.addMapping("/**") | |
.allowedHeaders("*") | |
.allowedMethods("*") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
void queryDslQueryTest() { | |
JPAQuery<StatusCommonTemplateExcelData> query = | |
jpaQueryFactory.select( | |
Projections.constructor( | |
StatusCommonTemplateExcelData.class, | |
Expressions.stringTemplate("'집품'"), | |
qWarehouse.name, // "창고" | |
qPacking.status, // "포장 상태" | |
qShipping.deliverySeq, // "배송 ID" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// mapstruct | |
annotationProcessor "org.mapstruct:mapstruct-processor:$mapstructVersion" | |
implementation "org.mapstruct:mapstruct:$mapstructVersion" | |
[For Java Developers: Forget BeanUtils and Trade for Performance and Code Simplicity by MapStruct | by Malvin Lok | Feb, 2024 | Medium](https://medium.com/@malvin.lok/for-java-developers-forget-beanutils-and-trade-for-performance-and-code-simplicity-by-mapstruct-b8934c830094) | |
@Data | |
@Builder | |
@AllArgsConstructor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// loading load runner | |
@Bean | |
public ApplicationRunner runner(BalanceRepository balanceRepository) { | |
return args -> { | |
// ... | |
}; | |
} | |
@Component | |
public class DataLoader implements CommandLineRunner { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pom.xml | |
<!-- Encryption Library --> | |
<dependency> | |
<groupId>com.github.ulisesbocchio</groupId> | |
<artifactId>jasypt-spring-boot-starter</artifactId> | |
<version>3.0.2</version> | |
</dependency> | |
<dependency> | |
<groupId>org.bouncycastle</groupId> | |
<artifactId>bcprov-jdk15on</artifactId> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Rule; | |
import org.junit.Test; | |
import org.springframework.boot.test.rule.OutputCapture; | |
import static org.hamcrest.Matchers.containsString; | |
public class OutputCaptureTest { | |
@Rule | |
public OutputCapture output = new OutputCapture(); |
NewerOlder