Skip to content

Commit

Permalink
[TEST] test code 작성
Browse files Browse the repository at this point in the history
  • Loading branch information
unanchoi committed Nov 28, 2023
1 parent 02570af commit dd9742e
Show file tree
Hide file tree
Showing 22 changed files with 1,831 additions and 83 deletions.
2 changes: 2 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ dependencies {
// lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
testCompileOnly 'org.projectlombok:lombok'
testAnnotationProcessor 'org.projectlombok:lombok'

// DB
runtimeOnly 'com.h2database:h2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ public record TokenResponseDTO(
String accessToken,
String refreshToken
) {

public static TokenResponseDTO of(String accessToken, String refreshToken) {
return new TokenResponseDTO(accessToken, refreshToken);
}
}
10 changes: 10 additions & 0 deletions src/main/java/com/smeme/server/dto/goal/GoalResponseDTO.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
package com.smeme.server.dto.goal;

import com.smeme.server.model.goal.Goal;

public record GoalResponseDTO(
String name,
String way,
String detail
) {

public static GoalResponseDTO of(Goal goal) {
return new GoalResponseDTO(
goal.getType().name(),
goal.getWay(),
goal.getDetail()
);
}
}
2 changes: 2 additions & 0 deletions src/main/java/com/smeme/server/model/Correction.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand All @@ -31,6 +32,7 @@ public class Correction {
@JoinColumn(name = "diary_id")
private Diary diary;

@Builder
public Correction(String beforeSentence, String afterSentence, Diary diary) {
this.beforeSentence = beforeSentence;
this.afterSentence = afterSentence;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/com/smeme/server/model/Diary.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static java.util.Objects.nonNull;

import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand Down Expand Up @@ -47,6 +48,7 @@ public class Diary extends BaseTimeEntity {
@OneToMany(mappedBy = "diary")
private final List<Correction> corrections = new ArrayList<>();

@Builder
public Diary(String content, Topic topic, Member member) {
this.content = content;
this.targetLang = member.getTargetLang();
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/smeme/server/model/badge/Badge.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

@Entity
@Getter
@NoArgsConstructor
public class Badge {

@Id
Expand All @@ -23,4 +26,13 @@ public class Badge {
private String name;

private String imageUrl;


@Builder
public Badge(Long id, BadgeType type, String name, String imageUrl) {
this.id = id;
this.type = type;
this.name = name;
this.imageUrl = imageUrl;
}
}
8 changes: 8 additions & 0 deletions src/main/java/com/smeme/server/model/goal/Goal.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import jakarta.persistence.Enumerated;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Builder;
import lombok.Getter;

@Entity
Expand All @@ -26,4 +27,11 @@ public class Goal {
private String way;

private String detail;

@Builder
public Goal(GoalType type, String way, String detail) {
this.type = type;
this.way = way;
this.detail = detail;
}
}
7 changes: 7 additions & 0 deletions src/main/java/com/smeme/server/model/topic/Topic.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static jakarta.persistence.GenerationType.*;

import jakarta.persistence.*;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;

Expand All @@ -20,4 +21,10 @@ public class Topic {
private Category category;

private String content;

@Builder
public Topic(Category category, String content) {
this.category = category;
this.content = content;
}
}
Loading

0 comments on commit dd9742e

Please sign in to comment.