forked from rongchao/epmet-cloud-rizhao
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.5 KiB
46 lines
1.5 KiB
|
5 years ago
|
package com.epmet;
|
||
|
|
|
||
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
||
|
|
import com.epmet.dto.form.DraftContentFromDTO;
|
||
|
|
import com.epmet.service.ArticleService;
|
||
|
|
import org.junit.Test;
|
||
|
|
import org.junit.runner.RunWith;
|
||
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
||
|
|
import org.springframework.test.context.junit4.SpringRunner;
|
||
|
|
|
||
|
|
import java.util.ArrayList;
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
@RunWith(SpringRunner.class)
|
||
|
|
@SpringBootTest
|
||
|
|
public class ArticleServiceTest {
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
@Autowired
|
||
|
|
private ArticleService articleService;
|
||
|
|
|
||
|
|
@Test
|
||
|
|
public void genToken() {
|
||
|
|
TokenDto tokenDto = new TokenDto();
|
||
|
|
tokenDto.setCustomerId("1");
|
||
|
|
tokenDto.setUserId("1");
|
||
|
|
DraftContentFromDTO draftContentFromDTO = new DraftContentFromDTO();
|
||
|
|
//draftContentFromDTO.setDraftId("1");
|
||
|
|
draftContentFromDTO.setTitle("testTitle");
|
||
|
|
List<DraftContentFromDTO.DraftContentDTO> list = new ArrayList<>();
|
||
|
|
for (int i = 0; i <2 ; i++) {
|
||
|
|
DraftContentFromDTO.DraftContentDTO contentDTO = new DraftContentFromDTO.DraftContentDTO();
|
||
|
|
contentDTO.setDraftContentId("");
|
||
|
|
contentDTO.setContent("内容"+i);
|
||
|
|
contentDTO.setContentType("text");
|
||
|
|
contentDTO.setOrderNum(1+i);
|
||
|
|
list.add(contentDTO);
|
||
|
|
}
|
||
|
|
draftContentFromDTO.setContentList(list);
|
||
|
|
String s = articleService.saveOrUpdateContent(tokenDto, draftContentFromDTO);
|
||
|
|
System.out.println(s);
|
||
|
|
}
|
||
|
|
}
|