-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'weekly' into feature/1-branch-account
- Loading branch information
Showing
8 changed files
with
73 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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
Empty file.
Empty file.
Empty file.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
server: | ||
servlet: | ||
encoding: | ||
charset: utf-8 | ||
force: true | ||
port: 8080 | ||
spring: | ||
datasource: | ||
url: jdbc:h2:mem:test;MODE=MySQL | ||
driver-class-name: org.h2.Driver | ||
username: sa | ||
password: | ||
h2: | ||
console: | ||
enabled: true | ||
jpa: | ||
hibernate: | ||
ddl-auto: create | ||
show-sql: true | ||
properties: | ||
hibernate: | ||
format_sql: true | ||
default_batch_fetch_size: 100 | ||
open-in-view: false |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
spring: | ||
profiles: | ||
active: local | ||
active: local |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.example.demo; | ||
|
||
import com.example.demo.account.Account; | ||
import com.example.demo.account.AccountJPARepository; | ||
import org.assertj.core.api.Assertions; | ||
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.context.SpringBootTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
|
||
@SpringBootTest | ||
@ActiveProfiles("test") | ||
public class AccountTest { | ||
|
||
@Autowired | ||
private AccountJPARepository accountJPARepository; | ||
|
||
// saveTest | ||
@Test | ||
@DisplayName("account save test") | ||
void test() { | ||
Account account = Account.builder() | ||
.uid(1) | ||
.email("[email protected]") | ||
.password("asdf1234!") | ||
.firstname("Jin") | ||
.lastname("Seung") | ||
.country("Korea") | ||
.age(21) | ||
.role(Account.Role.MENTOR) | ||
.build(); | ||
|
||
// account save | ||
accountJPARepository.save(account); | ||
|
||
// find | ||
Account account1 = accountJPARepository.findById(account.getUid()).get(); | ||
Assertions.assertThat(account.getUid()) | ||
.isEqualTo(account1.getUid()); | ||
} | ||
} |