-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: 테스트를 위한 설계 유연성 개선 (User테스트)
- Loading branch information
1 parent
95a5294
commit 2d21a80
Showing
71 changed files
with
1,140 additions
and
454 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/com/tukorea/planding/common/JsonConverter.java
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,31 @@ | ||
package com.tukorea.planding.common; | ||
|
||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.io.IOException; | ||
|
||
@Component | ||
@RequiredArgsConstructor | ||
public class JsonConverter { | ||
|
||
private final ObjectMapper objectMapper; | ||
|
||
public String convertObjectToJson(Object obj) { | ||
try { | ||
return objectMapper.writeValueAsString(obj); | ||
} catch (JsonProcessingException e) { | ||
return null; | ||
} | ||
} | ||
|
||
public <T> T convertJsonToObject(String json, Class<T> clazz) { | ||
try { | ||
return objectMapper.readValue(json, clazz); | ||
} catch (IOException e) { | ||
return null; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/tukorea/planding/common/infrastructure/SystemUserCode.java
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,14 @@ | ||
package com.tukorea.planding.common.infrastructure; | ||
|
||
import com.tukorea.planding.common.service.UserCodeHolder; | ||
import org.springframework.stereotype.Component; | ||
|
||
import java.util.UUID; | ||
|
||
@Component | ||
public class SystemUserCode implements UserCodeHolder { | ||
@Override | ||
public String userCode() { | ||
return "#" + UUID.randomUUID().toString().substring(0, 4); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
src/main/java/com/tukorea/planding/common/service/UserCodeHolder.java
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,5 @@ | ||
package com.tukorea.planding.common.service; | ||
|
||
public interface UserCodeHolder { | ||
String userCode(); | ||
} |
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
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
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
15 changes: 15 additions & 0 deletions
15
src/main/java/com/tukorea/planding/domain/group/entity/domain/GroupFavoriteDomain.java
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,15 @@ | ||
package com.tukorea.planding.domain.group.entity.domain; | ||
|
||
import com.tukorea.planding.domain.group.entity.GroupRoom; | ||
import com.tukorea.planding.domain.user.entity.User; | ||
import com.tukorea.planding.domain.user.entity.UserDomain; | ||
|
||
public class GroupFavoriteDomain { | ||
|
||
private Long id; | ||
|
||
private UserDomain user; | ||
|
||
private GroupRoomDomain groupRoom; | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/main/java/com/tukorea/planding/domain/group/entity/domain/GroupRoomDomain.java
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,36 @@ | ||
package com.tukorea.planding.domain.group.entity.domain; | ||
|
||
import com.tukorea.planding.domain.group.entity.GroupFavorite; | ||
import com.tukorea.planding.domain.group.entity.UserGroup; | ||
import com.tukorea.planding.domain.schedule.entity.GroupSchedule; | ||
import com.tukorea.planding.domain.user.entity.User; | ||
import com.tukorea.planding.domain.user.entity.UserDomain; | ||
import jakarta.persistence.JoinColumn; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Set; | ||
|
||
public class GroupRoomDomain { | ||
private Long id; | ||
|
||
private String name; | ||
|
||
private String description; | ||
|
||
private UserDomain owner; | ||
|
||
private String groupCode; // 그룹방 고유 식별값 | ||
|
||
private String thumbnail; | ||
|
||
private boolean alarm = true; | ||
|
||
private final Set<UserGroupDomain> userGroups = new HashSet<>(); | ||
|
||
private final List<GroupSchedule> groupSchedules = new ArrayList<>(); | ||
|
||
private final List<GroupFavoriteDomain> groupFavorites = new ArrayList<>(); | ||
|
||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/com/tukorea/planding/domain/group/entity/domain/UserGroupDomain.java
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,15 @@ | ||
package com.tukorea.planding.domain.group.entity.domain; | ||
|
||
|
||
import com.tukorea.planding.domain.group.entity.GroupRoom; | ||
import com.tukorea.planding.domain.user.entity.UserDomain; | ||
|
||
public class UserGroupDomain { | ||
private Long id; | ||
private UserDomain user; | ||
|
||
private GroupRoomDomain groupRoom; | ||
|
||
private boolean isConnected; | ||
|
||
} |
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
Oops, something went wrong.