From 97c4e2a6c2430b2613e84d38f4c02865b7f7778b Mon Sep 17 00:00:00 2001 From: minwoo0419 Date: Fri, 30 Aug 2024 13:54:57 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20=EC=8B=9C=EC=97=B0=EC=9A=A9=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8API=20=EC=82=AD=EC=A0=9C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/telepigeon/server/controller/TestController.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/telepigeon/server/controller/TestController.java b/src/main/java/com/telepigeon/server/controller/TestController.java index e19b1af..b36b04d 100644 --- a/src/main/java/com/telepigeon/server/controller/TestController.java +++ b/src/main/java/com/telepigeon/server/controller/TestController.java @@ -1,6 +1,5 @@ package com.telepigeon.server.controller; -import com.telepigeon.server.domain.Answer; import com.telepigeon.server.domain.Profile; import com.telepigeon.server.domain.Question; import com.telepigeon.server.domain.Token; @@ -96,10 +95,10 @@ public ResponseEntity testQuestion( Profile profile2 = profileRetriever.findById(93L); Question question1 = questionRetriever.findFirstByProfile(profile1); Question question2 = questionRetriever.findFirstByProfile(profile2); - Answer answer1 = answerRetriever.findByQuestion(question1); - Answer answer2 = answerRetriever.findByQuestion(question2); - answerRepository.delete(answer1); - answerRepository.delete(answer2); + if (answerRetriever.existsByQuestion(question1)) + answerRepository.delete(answerRetriever.findByQuestion(question1)); + if (answerRetriever.existsByQuestion(question2)) + answerRepository.delete(answerRetriever.findByQuestion(question2)); questionRepository.delete(question1); questionRepository.delete(question2); questionService.create(profile1);