|
|
@ -13,6 +13,7 @@ import org.apache.commons.io.IOUtils; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
import org.springframework.boot.test.context.SpringBootTest; |
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
import org.springframework.web.multipart.commons.CommonsMultipartFile; |
|
|
|
|
|
|
|
|
|
|
@ -52,30 +53,35 @@ class QuestionsServiceTest { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Transactional |
|
|
|
void saveQuestion() { |
|
|
|
void saveQuestion() { |
|
|
|
QuestionsAddRequest questions = new QuestionsAddRequest(); |
|
|
|
QuestionsAddRequest questions = new QuestionsAddRequest(); |
|
|
|
System.out.println(questionsService.saveQuestion(questions)); |
|
|
|
System.out.println(questionsService.saveQuestion(questions)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Transactional |
|
|
|
void updateQuestionById() { |
|
|
|
void updateQuestionById() { |
|
|
|
QuestionsUpdateRequest questions = new QuestionsUpdateRequest(); |
|
|
|
QuestionsUpdateRequest questions = new QuestionsUpdateRequest(); |
|
|
|
System.out.println(questionsService.updateQuestionById(questions)); |
|
|
|
System.out.println(questionsService.updateQuestionById(questions)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Transactional |
|
|
|
void isnable() { |
|
|
|
void isnable() { |
|
|
|
Integer id = 1; |
|
|
|
Integer id = 1; |
|
|
|
System.out.println(questionsService.isnable(id)); |
|
|
|
System.out.println(questionsService.isnable(id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Transactional |
|
|
|
void deleteByIds() { |
|
|
|
void deleteByIds() { |
|
|
|
List<Integer> asList = new ArrayList<>(); |
|
|
|
List<Integer> asList = new ArrayList<>(); |
|
|
|
System.out.println(questionsService.deleteByIds(asList)); |
|
|
|
System.out.println(questionsService.deleteByIds(asList)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
@Test |
|
|
|
|
|
|
|
@Transactional |
|
|
|
void importQuestion() throws IOException { |
|
|
|
void importQuestion() throws IOException { |
|
|
|
File file = new File("D:\\pic\\1.jpg"); |
|
|
|
File file = new File("D:\\pic\\1.jpg"); |
|
|
|
FileItem fileItem = new DiskFileItem("file", |
|
|
|
FileItem fileItem = new DiskFileItem("file", |
|
|
|