Skip to content

Commit

Permalink
Google Java Format
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 9, 2023
1 parent fc8d695 commit ae27bdb
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest;
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
Expand All @@ -19,14 +20,16 @@
import com.twtw.backend.domain.group.dto.response.SimpleGroupInfoResponse;
import com.twtw.backend.domain.group.service.GroupService;
import com.twtw.backend.support.docs.RestDocsTest;
import java.util.UUID;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;

import java.util.UUID;

@DisplayName("GroupController의")
@WebMvcTest(GroupController.class)
class GroupControllerTest extends RestDocsTest {
Expand Down Expand Up @@ -113,8 +116,7 @@ void joinGroup() throws Exception {
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));

// then
perform.andExpect(status().isOk())
.andExpect(jsonPath("$.groupId").isString());
perform.andExpect(status().isOk()).andExpect(jsonPath("$.groupId").isString());

// docs
perform.andDo(print())
Expand All @@ -125,15 +127,20 @@ void joinGroup() throws Exception {
@DisplayName("그룹 초대 API가 수행되는가")
void inviteGroup() throws Exception {
// given
final GroupInfoResponse expected = new GroupInfoResponse(UUID.randomUUID(), UUID.randomUUID(), "홍담진", "http://someUrlToS3");
final GroupInfoResponse expected =
new GroupInfoResponse(
UUID.randomUUID(), UUID.randomUUID(), "홍담진", "http://someUrlToS3");
given(groupService.inviteGroup(any())).willReturn(expected);

// when
final ResultActions perform =
mockMvc.perform(
post("/group/invite")
.contentType(MediaType.APPLICATION_JSON)
.content(toRequestBody(new InviteGroupRequest(UUID.randomUUID(), UUID.randomUUID())))
.content(
toRequestBody(
new InviteGroupRequest(
UUID.randomUUID(), UUID.randomUUID())))
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));
Expand All @@ -156,7 +163,10 @@ void changeShare() throws Exception {
mockMvc.perform(
post("/group/share/" + UUID.randomUUID())
.contentType(MediaType.APPLICATION_JSON)
.content(toRequestBody(new InviteGroupRequest(UUID.randomUUID(), UUID.randomUUID())))
.content(
toRequestBody(
new InviteGroupRequest(
UUID.randomUUID(), UUID.randomUUID())))
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));
Expand All @@ -173,22 +183,25 @@ void changeShare() throws Exception {
@DisplayName("위치 공유 조회 API가 수행되는가")
void getShare() throws Exception {
// given
final ShareInfoResponse expected = new ShareInfoResponse(UUID.randomUUID(), UUID.randomUUID(), true);
final ShareInfoResponse expected =
new ShareInfoResponse(UUID.randomUUID(), UUID.randomUUID(), true);
given(groupService.getShare(any())).willReturn(expected);

// when
final ResultActions perform =
mockMvc.perform(
get("/group/share/" + UUID.randomUUID())
.contentType(MediaType.APPLICATION_JSON)
.content(toRequestBody(new InviteGroupRequest(UUID.randomUUID(), UUID.randomUUID())))
.content(
toRequestBody(
new InviteGroupRequest(
UUID.randomUUID(), UUID.randomUUID())))
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));

// then
perform.andExpect(status().isOk())
.andExpect(jsonPath("$.share").isBoolean());
perform.andExpect(status().isOk()).andExpect(jsonPath("$.share").isBoolean());

// docs
perform.andDo(print())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentRequest;
import static com.twtw.backend.support.docs.ApiDocsUtils.getDocumentResponse;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.BDDMockito.given;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
Expand All @@ -23,15 +24,17 @@
import com.twtw.backend.domain.plan.dto.response.PlanResponse;
import com.twtw.backend.domain.plan.service.PlanService;
import com.twtw.backend.support.docs.RestDocsTest;
import java.util.List;
import java.util.UUID;

import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.ResultActions;

import java.util.List;
import java.util.UUID;

@DisplayName("PlanController의")
@WebMvcTest(PlanController.class)
class PlanControllerTest extends RestDocsTest {
Expand Down Expand Up @@ -107,15 +110,20 @@ void savePlan() throws Exception {
mockMvc.perform(
post("/plans")
.contentType(MediaType.APPLICATION_JSON)
.content(toRequestBody(new SavePlanRequest(UUID.randomUUID(), new PlaceDetails("카페 온마이마인드",
"345",
"https://place.map.kakao.com/1625295668",
"음식점 > 카페",
"경기 안성시 죽산면 죽산리 414",
"경기 안성시 죽산면 죽산초교길 36-4",
CategoryGroupCode.CE7,
"127.420430538256",
"37.0766874564297"))))
.content(
toRequestBody(
new SavePlanRequest(
UUID.randomUUID(),
new PlaceDetails(
"카페 온마이마인드",
"345",
"https://place.map.kakao.com/1625295668",
"음식점 > 카페",
"경기 안성시 죽산면 죽산리 414",
"경기 안성시 죽산면 죽산초교길 36-4",
CategoryGroupCode.CE7,
"127.420430538256",
"37.0766874564297"))))
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));
Expand All @@ -133,15 +141,23 @@ void savePlan() throws Exception {
@DisplayName("단건 조회 API가 수행되는가")
void getPlanById() throws Exception {
// given
final PlanInfoResponse expected = new PlanInfoResponse(UUID.randomUUID(), UUID.randomUUID(), new PlaceDetails("카페 온마이마인드",
"345",
"https://place.map.kakao.com/1625295668",
"음식점 > 카페",
"경기 안성시 죽산면 죽산리 414",
"경기 안성시 죽산면 죽산초교길 36-4",
CategoryGroupCode.CE7,
"127.420430538256",
"37.0766874564297"), new GroupInfoResponse(UUID.randomUUID(), UUID.randomUUID(), "홍담진", "http://someUrlToS3"), List.of(new MemberResponse(UUID.randomUUID(), "진호정")));
final PlanInfoResponse expected =
new PlanInfoResponse(
UUID.randomUUID(),
UUID.randomUUID(),
new PlaceDetails(
"카페 온마이마인드",
"345",
"https://place.map.kakao.com/1625295668",
"음식점 > 카페",
"경기 안성시 죽산면 죽산리 414",
"경기 안성시 죽산면 죽산초교길 36-4",
CategoryGroupCode.CE7,
"127.420430538256",
"37.0766874564297"),
new GroupInfoResponse(
UUID.randomUUID(), UUID.randomUUID(), "홍담진", "http://someUrlToS3"),
List.of(new MemberResponse(UUID.randomUUID(), "진호정")));
given(planService.getPlanById(any())).willReturn(expected);

// when
Expand Down Expand Up @@ -193,16 +209,20 @@ void joinPlan() throws Exception {
mockMvc.perform(
post("/plans/join")
.contentType(MediaType.APPLICATION_JSON)
.content(toRequestBody(new SavePlanRequest(UUID.randomUUID(), new PlaceDetails(
"이디야커피 안성죽산점",
"435",
"http://place.map.kakao.com/1562566188",
"음식점 > 카페 > 커피전문점 > 이디야커피",
"경기 안성시 죽산면 죽산리 118-3",
"경기 안성시 죽산면 죽주로 287-1",
CategoryGroupCode.CE7,
"127.426865189637",
"37.0764635355795"))))
.content(
toRequestBody(
new SavePlanRequest(
UUID.randomUUID(),
new PlaceDetails(
"이디야커피 안성죽산점",
"435",
"http://place.map.kakao.com/1562566188",
"음식점 > 카페 > 커피전문점 > 이디야커피",
"경기 안성시 죽산면 죽산리 118-3",
"경기 안성시 죽산면 죽주로 287-1",
CategoryGroupCode.CE7,
"127.426865189637",
"37.0764635355795"))))
.header(
"Authorization",
"Bearer wefa3fsdczf32.gaoiuergf92.gb5hsa2jgh"));
Expand Down

0 comments on commit ae27bdb

Please sign in to comment.