コード例 #1
0
  /** 按条件查询 */
  @Test
  public void testListDpNewsPageOfDpNewsDpNews() throws Exception {
    DpType dpType = new DpType();
    DpNews dn = new DpNews();

    Page<DpNews> page = new Page<DpNews>();
    page.setPageSize(10);
    page.setCurrentPage(1);

    dn.setDpType(dpType);
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);

    dn.setNewsTitle("test");
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);

    dn.setNewsSource("coship");
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);

    dn.setBeginNewsCtime("2011-12-01");
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);

    dn.setBeginNewsCtime(null);
    dn.setEndNewsCtime("2012-01-20");
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);

    dn.setBeginNewsCtime("2011-12-01");
    dn.setEndNewsCtime("2012-01-20");
    page = this.dpNewsService.listDpNews(page, dn);
    Assert.assertNotNull(page);
  }
コード例 #2
0
  /**
   * Test method for {@link
   * com.coship.sdp.sce.dp.news.service.impl.DpNewsServiceImpl#updateDpNews(com.coship.sdp.sce.dp.news.entity.DpNews)}
   * .
   *
   * @throws Exception
   */
  @Test
  public void testUpdateDpNews() throws Exception {

    DpNews dn = new DpNews();
    dn.setId("1");
    String newsTitle = "iOS";
    dn.setNewsTitle(newsTitle);
    this.dpNewsService.updateDpNews(dn);
    Assert.assertEquals(newsTitle, dn.getNewsTitle());
  }