Skip to content

Commit

Permalink
[Weekly/11/Refactor/Test-TeatData] testdata 리팩터링 (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
lja3723 authored Nov 12, 2024
1 parent 354b5c7 commit a14b33b
Show file tree
Hide file tree
Showing 27 changed files with 1,050 additions and 538 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
@Builder
public class ImageRequest {

private String url;
private String name;
private Long size;
private String extension;

public static ImageRequest of(String url, Long size, String extension) {
public static ImageRequest of(String name, Long size, String extension) {
return ImageRequest.builder()
.url(url)
.name(name)
.size(size)
.extension(extension)
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String getChildPath() {
@Override
protected AdvertisementImage toEntity(ImageRequest imageRequest) {
return AdvertisementImage.builder()
.name(imageRequest.getUrl())
.name(imageRequest.getName())
.size(imageRequest.getSize())
.extension(imageRequest.getExtension())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getChildPath() {
@Override
protected CurationImage toEntity(ImageRequest imageRequest) {
return CurationImage.builder()
.name(imageRequest.getUrl())
.name(imageRequest.getName())
.size(imageRequest.getSize())
.extension(imageRequest.getExtension())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getChildPath() {
@Override
protected EventImage toEntity(ImageRequest imageRequest) {
return EventImage.builder()
.name(imageRequest.getUrl())
.name(imageRequest.getName())
.size(imageRequest.getSize())
.extension(imageRequest.getExtension())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected String getChildPath() {
@Override
protected MemberImage toEntity(ImageRequest imageRequest) {
return MemberImage.builder()
.name(imageRequest.getUrl())
.name(imageRequest.getName())
.size(imageRequest.getSize())
.extension(imageRequest.getExtension())
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public ResponseEntity<ApiResponseBody<Void>> handleMethodArgumentTypeMismatchExc
public ResponseEntity<ApiResponseBody<Void>> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
return ApiResponse.error(ErrorCode.INVALID_INPUT_VALUE, e.getBindingResult().getFieldErrors().stream()
.map(DefaultMessageSourceResolvable::getDefaultMessage)
// .map((reslover) -> "필드명: " + reslover.getField() + reslover.getDefaultMessage())
.collect(Collectors.joining(", ")));
}
}
140 changes: 0 additions & 140 deletions src/test/java/org/ktc2/cokaen/wouldyouin/_global/TestData.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData.R.curator;
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType;

@Retention(RetentionPolicy.RUNTIME)
@WithMockCustomUser(memberId = MemberData.validCuratorId, memberType = MemberType.curator)
@WithMockCustomUser(memberId = curator.id, memberType = MemberType.curator)
public @interface WithMockCurator {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData.R.host;
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType;

@Retention(RetentionPolicy.RUNTIME)
@WithMockCustomUser(memberId = MemberData.validHostId, memberType = MemberType.host)
@WithMockCustomUser(memberId = host.id, memberType = MemberType.host)
public @interface WithMockHost {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData.R.normal;
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType;

@Retention(RetentionPolicy.RUNTIME)
@WithMockCustomUser(memberId = MemberData.validMemberId, memberType = MemberType.normal)
@WithMockCustomUser(memberId = normal.id, memberType = MemberType.normal)
public @interface WithMockMember {

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData;
import org.ktc2.cokaen.wouldyouin._global.testdata.MemberData.R.welcome;
import org.ktc2.cokaen.wouldyouin.member.persist.MemberType;

@Retention(RetentionPolicy.RUNTIME)
@WithMockCustomUser(memberId = MemberData.validWelcomeMemberId, memberType = MemberType.welcome)
@WithMockCustomUser(memberId = welcome.id, memberType = MemberType.welcome)
public @interface WithMockWelcomeMember {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.ktc2.cokaen.wouldyouin._global.testdata;

import org.ktc2.cokaen.wouldyouin._common.api.SliceInfo;

public class CommonData {

public static class sliceInfo {

public static SliceInfo get() {
return SliceInfo.builder()
.sliceSize(10)
.lastId(100L)
.build();
}
}

}
Loading

0 comments on commit a14b33b

Please sign in to comment.