File tree Expand file tree Collapse file tree 6 files changed +15
-15
lines changed
main/java/com/somemore/community Expand file tree Collapse file tree 6 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 88
99public interface CommunityBoardRepository {
1010 CommunityBoard save (CommunityBoard communityBoard );
11- Optional <CommunityBoard > getCommunityBoardWithId (Long id );
11+ Optional <CommunityBoard > findById (Long id );
1212 List <CommunityBoard > getCommunityBoards ();
13- List <CommunityBoard > getCommunityBoardsByWriterId (UUID writerId );
13+ List <CommunityBoard > findByWriterId (UUID writerId );
1414 void deleteAllInBatch ();
1515}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ public CommunityBoard save(CommunityBoard communityBoard) {
2323 }
2424
2525 @ Override
26- public Optional <CommunityBoard > getCommunityBoardWithId (Long id ) {
26+ public Optional <CommunityBoard > findById (Long id ) {
2727 QCommunityBoard communityBoard = QCommunityBoard .communityBoard ;
2828
2929 return Optional .ofNullable (queryFactory
@@ -45,7 +45,7 @@ public List<CommunityBoard> getCommunityBoards() {
4545 }
4646
4747 @ Override
48- public List <CommunityBoard > getCommunityBoardsByWriterId (UUID writerId ) {
48+ public List <CommunityBoard > findByWriterId (UUID writerId ) {
4949 QCommunityBoard communityBoard = QCommunityBoard .communityBoard ;
5050
5151 return queryFactory
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ public List<CommunityBoardGetResponseDto> getCommunityBoards() {
4343
4444 @ Override
4545 public List <CommunityBoardGetResponseDto > getCommunityBoardsByWriterId (UUID writerId ) {
46- List <CommunityBoard > boards = communityBoardRepository .getCommunityBoardsByWriterId (writerId );
46+ List <CommunityBoard > boards = communityBoardRepository .findByWriterId (writerId );
4747 String writerNickname = getWriterNickname (writerId );
4848
4949 return boards .stream ()
@@ -53,7 +53,7 @@ public List<CommunityBoardGetResponseDto> getCommunityBoardsByWriterId(UUID writ
5353
5454 @ Override
5555 public CommunityBoardGetDetailResponseDto getCommunityBoardDetail (Long id ) {
56- CommunityBoard board = communityBoardRepository .getCommunityBoardWithId (id )
56+ CommunityBoard board = communityBoardRepository .findById (id )
5757 .orElseThrow (() -> new BadRequestException (NOT_EXISTS_COMMUNITY_BOARD .getMessage ()));
5858
5959 return CommunityBoardGetDetailResponseDto .fromEntity (board , getWriterDetail (board .getWriterId ()));
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ void getCommunityBoardById() {
3333 communityBoardRepository .save (communityBoard );
3434
3535 //when
36- Optional <CommunityBoard > foundCommunityBoard = communityBoardRepository .getCommunityBoardWithId (communityBoard .getId ());
36+ Optional <CommunityBoard > foundCommunityBoard = communityBoardRepository .findById (communityBoard .getId ());
3737
3838 //then
3939 assertThat (foundCommunityBoard ).isNotNull ();
@@ -58,7 +58,7 @@ void getCommunityBoardByDeletedId() {
5858 communityBoardRepository .deleteAllInBatch ();
5959
6060 //when
61- Optional <CommunityBoard > foundCommunityBoard = communityBoardRepository .getCommunityBoardWithId (communityBoard .getId ());
61+ Optional <CommunityBoard > foundCommunityBoard = communityBoardRepository .findById (communityBoard .getId ());
6262
6363 //then
6464 assertThat (foundCommunityBoard ).isEmpty ();
@@ -124,7 +124,7 @@ void getCommunityBoardsByWriterId() {
124124 communityBoardRepository .save (communityBoard3 );
125125
126126 //when
127- List <CommunityBoard > communityBoards = communityBoardRepository .getCommunityBoardsByWriterId (communityBoard1 .getWriterId ());
127+ List <CommunityBoard > communityBoards = communityBoardRepository .findByWriterId (communityBoard1 .getWriterId ());
128128
129129 //then
130130 assertThat (communityBoards ).hasSize (2 );
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ void createCommunityWithDto() {
4141 Long communityId = createCommunityBoardService .createCommunityBoard (dto , writerId , imgUrl );
4242
4343 //then
44- Optional <CommunityBoard > communityBoard = communityBoardRepository .getCommunityBoardWithId (communityId );
44+ Optional <CommunityBoard > communityBoard = communityBoardRepository .findById (communityId );
4545
4646 assertThat (communityBoard ).isPresent ();
4747 assertThat (communityBoard .get ().getId ()).isEqualTo (communityId );
@@ -67,7 +67,7 @@ void createCommunityWithoutImgUrl() {
6767 Long communityId = createCommunityBoardService .createCommunityBoard (dto , writerId , imgUrl );
6868
6969 //then
70- Optional <CommunityBoard > communityBoard = communityBoardRepository .getCommunityBoardWithId (communityId );
70+ Optional <CommunityBoard > communityBoard = communityBoardRepository .findById (communityId );
7171
7272 assertThat (communityBoard ).isPresent ();
7373 assertThat (communityBoard .get ().getId ()).isEqualTo (communityId );
Original file line number Diff line number Diff line change @@ -85,8 +85,8 @@ void getAllCommunityBoards() {
8585 List <CommunityBoardGetResponseDto > dtos = communityBoardQueryService .getCommunityBoards ();
8686
8787 // then
88- Optional <CommunityBoard > communityBoard1 = communityBoardRepository .getCommunityBoardWithId (communityId1 );
89- Optional <CommunityBoard > communityBoard2 = communityBoardRepository .getCommunityBoardWithId (communityId2 );
88+ Optional <CommunityBoard > communityBoard1 = communityBoardRepository .findById (communityId1 );
89+ Optional <CommunityBoard > communityBoard2 = communityBoardRepository .findById (communityId2 );
9090
9191
9292 assertThat (dtos )
@@ -135,8 +135,8 @@ void getCommunityBoardsByWriter() {
135135 List <CommunityBoardGetResponseDto > dtos = communityBoardQueryService .getCommunityBoardsByWriterId (volunteer .getId ());
136136
137137 //then
138- Optional <CommunityBoard > communityBoard1 = communityBoardRepository .getCommunityBoardWithId (communityId1 );
139- Optional <CommunityBoard > communityBoard2 = communityBoardRepository .getCommunityBoardWithId (communityId2 );
138+ Optional <CommunityBoard > communityBoard1 = communityBoardRepository .findById (communityId1 );
139+ Optional <CommunityBoard > communityBoard2 = communityBoardRepository .findById (communityId2 );
140140
141141 assertThat (dtos )
142142 .isNotNull ()
You can’t perform that action at this time.
0 commit comments