|
|
@ -1,5 +1,7 @@ |
|
|
|
package com.bupt.note; |
|
|
|
package com.bupt.note; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.bupt.note.Model.Paper; |
|
|
|
|
|
|
|
import com.bupt.note.Repository.PaperRepository; |
|
|
|
import com.bupt.note.service.FileService; |
|
|
|
import com.bupt.note.service.FileService; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.BeforeEach; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
|
import org.junit.jupiter.api.Test; |
|
|
@ -14,6 +16,7 @@ import org.springframework.test.web.servlet.setup.MockMvcBuilders; |
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
import org.springframework.web.context.WebApplicationContext; |
|
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
import java.io.IOException; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
@SpringBootTest |
|
|
|
@SpringBootTest |
|
|
|
class NoteApplicationTests { |
|
|
|
class NoteApplicationTests { |
|
|
@ -26,6 +29,9 @@ class NoteApplicationTests { |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private FileService fileService; |
|
|
|
private FileService fileService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
private PaperRepository paperRepository; |
|
|
|
|
|
|
|
|
|
|
|
@BeforeEach |
|
|
|
@BeforeEach |
|
|
|
public void setUp() { |
|
|
|
public void setUp() { |
|
|
|
mvc = MockMvcBuilders.webAppContextSetup(context).build(); |
|
|
|
mvc = MockMvcBuilders.webAppContextSetup(context).build(); |
|
|
@ -45,4 +51,10 @@ class NoteApplicationTests { |
|
|
|
public void testRead() throws IOException { |
|
|
|
public void testRead() throws IOException { |
|
|
|
String a= fileService.getContent("E:\\JetBrains\\IdeaProjects\\back-end code\\target\\classes\\resources\\static\\txt\\1aee7062-58a7-46e0-ba4d-84a9a14f4205.txt"); |
|
|
|
String a= fileService.getContent("E:\\JetBrains\\IdeaProjects\\back-end code\\target\\classes\\resources\\static\\txt\\1aee7062-58a7-46e0-ba4d-84a9a14f4205.txt"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void testPaper(){ |
|
|
|
|
|
|
|
List<Paper> papers=paperRepository.recommend(); |
|
|
|
|
|
|
|
System.out.println(papers.size()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|