package com.talentcard.server; import static org.assertj.core.api.Assertions.assertThat; import java.util.Map; import com.talentcard.server.business.PageResult; import com.talentcard.server.business.admin.AdminBusinessService; import com.talentcard.server.business.admin.NewsArticleRequest; import com.talentcard.server.business.portal.PortalService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.test.context.ActiveProfiles; import org.springframework.beans.factory.annotation.Autowired; @SpringBootTest @ActiveProfiles("test") class TalentCardServerApplicationTests { @Autowired private JdbcTemplate jdbcTemplate; @Autowired private PortalService portalService; @Autowired private AdminBusinessService adminBusinessService; @BeforeEach void clearNewsArticles() { jdbcTemplate.update("delete from news_article"); } @Test void contextLoads() { } @Test void publishedNewsIsListedAndDetailIncrementsViewCount() { jdbcTemplate.update(""" insert into news_article(title, summary, source, content, view_count, is_top, sort_no, publish_time, status) values (?, ?, ?, ?, ?, ?, ?, current_timestamp, ?) """, "已发布资讯", "摘要", "东区发布", "
正文
", 7, 1, 10, 1); jdbcTemplate.update(""" insert into news_article(title, summary, source, content, view_count, is_top, sort_no, publish_time, status) values (?, ?, ?, ?, ?, ?, ?, current_timestamp, ?) """, "草稿资讯", "草稿摘要", "东区发布", "草稿
", 0, 0, 0, 0); PageResult