Skip to content

Commit

Permalink
Merge branch 'weekly' into feature/1-branch-account
Browse files Browse the repository at this point in the history
  • Loading branch information
sjmjys954646 authored Oct 8, 2023
2 parents bbb3390 + e107b1a commit e9235e9
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 3 deletions.
5 changes: 5 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ dependencies {
testImplementation 'org.springframework.security:spring-security-test'

implementation group: 'com.auth0', name: 'java-jwt', version: '4.3.0'

implementation 'org.springframework.boot:spring-boot-devtools'

// local, test : h2
runtimeOnly 'com.h2database:h2'
}

tasks.named('test') {
Expand Down
Empty file.
Empty file.
Empty file.
3 changes: 1 addition & 2 deletions src/main/resources/application-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ server:
charset: utf-8
force: true
port: 8080

spring:
datasource:
url: jdbc:h2:tcp://localhost/~/test;MODE=MySQL
Expand All @@ -22,4 +21,4 @@ spring:
hibernate:
format_sql: true
default_batch_fetch_size: 100
open-in-view: false
open-in-view: false
24 changes: 24 additions & 0 deletions src/main/resources/application-test.yml
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
2 changes: 1 addition & 1 deletion src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
spring:
profiles:
active: local
active: local
42 changes: 42 additions & 0 deletions src/test/java/com/example/demo/AccountTest.java
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());
}
}

0 comments on commit e9235e9

Please sign in to comment.