问题描述
如图的错误为什么值一样却是flase啊
解决方案
解决方案二:
void"newlypublishedblogshouldattopofrecentblogentries"(){given:defnow=newDate()blogFacadeService.publish(newBlogEntryDTO(title:'title',content:'content',dateCreated:now))defentry=blogFacadeService.getRecentEntries(1)[0]expect:entry.title=='title'entry.content=='content'entry.dateCreated==now}服务类:classBlogFacadeServiceimplementsBlogFacade{List<BlogEntryDTO>a//列表变量a@Overridevoidpublish(BlogEntryDTOentry){defp=newBlogEntryDTO(title:entry.title,content:entry.content,dateCreated:entry.dateCreated)try{//捕获异常p.save()}catch(Exceptione){printlnnewString("保存失败!".getBytes(),"utf-8")thrownewRuntimeException(newString("保存失败!".getBytes(),"utf-8"))}a=p.list(max:10,offset:0,sort:"dateCreated",order:"desc")//排序}@OverrideList<BlogEntryDTO>getRecentEntries(intn){List<BlogEntryDTO>bfor(iin1..<n+1){b=areturnb}}}