??xml version="1.0" encoding="utf-8" standalone="yes"?> UTC:短L传送很q,可能l过许多国家、许多不同时区,所以需要有一l时间作标准Q?q个标准旉Co-ordinated Universal Time ~写UTC 或称 UT。过ȝ为格林威L_GMTQ,虽然有些地方有冬令时间或夏o旉Q但UTC旉是不会改的,大家都以它ؓ标准?/p>
DST:Daylight saving time .(夏oӞ各个国家开始和l束旉的计方法是不一L) 德国、意大利{多数欧z国家夏令时h旉Q每q?月䆾最后一个星期天?0月䆾最后一个星期天?/p>
很多朋友对于剧官方|站上的旉表达方式不是很理解?br>q里说明一下,以Prison BreakZQMonday 8/7c 相对于美国,我们国家的时区划分相对简单很多,特别是取消夏令时后,不出国,我们基本上不用考虑时差问题?/p>
国本土大陆地区采用的时东向西ؓQ?br>东岸标准时区 (Eastern Standard Time; EST; UTC-5; R?Q包括大西洋沿岸各州、墨西哥湑֏密西西比河以东地区? 国本土大陆地区以外地区采用的时?br>阿拉斯加标准时区 (Alaska Standard Time; AKST; UTC-9; V? 包括阿拉斯加州大部䆾地区? 国属土采用的时?br>大西z标准时?(Atlantic Standard Time; AST, UTC-4; Q? 包括波多黎各及美属处奛_? 中国的时区:我们使用北京旉Q以前称中原标准旉Q现在台湾依然用这个名Uͼ是中国大陆、香港、澳門和台湄标准旉。在时区划分上,属东八区Q比世界协调时早8时Q记为UTC+8?/p>
严格地讲Q北京时间ƈ不是北京Q东l?16°Q地方的旉Q而是东经120°度地方的地方旉。而北京时间也不是在北京确定的Q而是׃于中国版囑և何中心位|陕西潼的中国U学院国家授时中心的9台铯原子钟和2台氢原子钟组通过_֯比对和计实玎ͼq过卫星与世界各国授旉门进行实时比寏V?/p>
清光l?8q_公元1902q_Q中国vx制定岸Ӟ以东l?20度之时刻为标准。公?912q_位于北京的中央观象台全国分Z个时区,民国28q??日中华民国内攉K召集标准旉会议Q确?912q划分之时区Z华民国标准时区。分别ؓ: ׃中国大陆全境都采用北京时间作为标准时Q因此在中国襉K的陕ѝ甘肃、新疆等省和自治区造成了生zM便,比如在乌鲁木齐,北京旉比当地时间提前两个小Ӟ北京旉??0分(中国大陆公务机关通行的上班时_相当于当地时间早??0分。作x施,一些新疆地区居民用乌鲁木齐时_即东六区QUTC+6Q时间?/p>
2005q_一些中华h民共和国全国人民代表大会代表提出中国大陆时区加以细分的Q提议分Z北京旉为基的东部时_UTC+8Q、以陕西地区旉为基的中部时_UTC+7Q和以新疆、西藏地区时间ؓ基础的西部时_UTC+6Q。后又将该提议改为分Z个时区,即UTC+8和UTC+7两个时区Q陕ѝ四川、重庆、贵州、云南及以西各省采用UTC+7的西部时间。但该提案尚未ʎ诸表冟?br>
]]>
]]>
]]>
b、String UTCToTime(long,timezone) //把给定的UTC转化为制定时区的旉
c、timeToTime(time,timezone1,timezone2) //把给定的旉Ҏ制定的时{化ؓ另指定时区的旉
//考虑到数据的存储Q还必须考虑数据库对于时间字D늚格式?br>
二、解x?br> 昄旉的不同,主要原因的是时区不同。如果不考虑自定义时区的问题QJODA包就能很好解决上面的问题Q但是如果考虑自定义时区(很多软g׃考虑夏oӞ从而增加了自定义时区的功能来设|夏令时Q,则我们必自己来写{换函数?br> a、JODA
public long timeToUTC(String theSourceTime, int sourceWbxTZID)
2 throws Exception
{
3 DateTime targDate;
4 if (sourceWbxTZID == (-1))
{ //UTC
5 //mdyFormatter:org.joda.time.format.DateTimeFormatter
6 targDate = mdyFormatter.withZone(DateTimeZone.UTC).parseDateTime(theSourceTime);//
7 } else
{
8 targDate = mdyFormatter.withZone(
9 DateTimeZone.forID(convertTimezone(sourceWbxTZID)))
10 .parseDateTime(theSourceTime);
11 }
12 return targDate.getMillis();
13 }
14 public String UTCToTime(long theUTCTime, int targetWbxTZID)
15 throws Exception
{
16 DateTime theSourceTime = new DateTime(theUTCTime);
17 if (targetWbxTZID == (-1))
{
18 return mdyFormatter.withZone(DateTimeZone.UTC).print(theSourceTime);
19 } else
{
20 return mdyFormatter.withZone(
21 DateTimeZone.forID(convertTimezone(targetWbxTZID))).print(
22 theSourceTime);
23 }
24 }
b、自~写
/** *//**
2 *sourceDateQ需要{换的日期Q此日期必须是居于GMT的时间?br> 3
*timezoneQ?br> 4
*gMTQ是否是GMT旉
5 *isConsiderDayLightQ是否考虑夏o?br> 6
*/
7 private long convert(Date sourceDate, Timezone timezone, boolean gMT, boolean isConsiderDayLight) throws Exception
{
8 int gMTOffSet = (int) timezone.getGmtOffset();//获取偏移?/span>
9 long sourceTime = sourceDate.getTime();
10 if (gMT)
{
11 targetTime = sourceTime + gMTOffSet * 60 * 1000;
12 } else
{
13 targetTime = sourceTime + ( -1) * gMTOffSet * 60 * 1000;//北京偏移8个小Ӟ如是Q?8*60*1000
14 }
15 //下面是考虑夏o?/span>
16
17 return targetTime;
18
19 }
20 public long timeToUTC(String theSourceTime, int sourceWbxTZID)
21 throws Exception
{
22 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
23 sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
24 Date date=sdf.parse(theSourceTime);
25 Timezone timezone=(Timezone)keyedByWbxTZID.get(String.valueOf(sourceWbxTZID));//此函C要是获取Timezone相关的数?/span>
26 return convert(date,timezone,false,true);
27 }
28 public String UTCToTime(long theUTCTime, int targetWbxTZID)
29 throws Exception
{
30 Date date=new Date();
31 date.setTime(theUTCTime);
32 Timezone timezone=(Timezone)keyedByWbxTZID.get(String.valueOf(targetWbxTZID));//此函C要是获取Timezone相关的数?/span>
33 long time=convert(date,timezone,true,true);
34 SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
35 sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
36 return sdf.format(new Date(time));
37 }
三、相关的一些时间概?nbsp;
GMT:是格林威治标准旉的英文羃写,格林威治是u敦泰晤士沛_岸的一个地方,׃?9世纪开始,因ؓ世界各国来往频繁Q而欧z大陆、美z大陆和亚洲大陆都有各自的时区,所以ؓ免乱,各国的代表就?884 q在国华盛召开了国际大会,通过协议选出伦敦的格林威治,作ؓ全球旉的中心点Q格林威L准时间因而诞生。所以有GMT功能的腕表就是说腕表拥有其中的小时表盘可以显CGMT旉?/p>
国Q加拿大夏o时v止时_每年3月䆾W二个星期天?1月䆾W一个星期天Q亚利桑那州、夏威夷、L多黎各、维京岛和美属萨摩亚除外Q?/p>
MST:Mountain Standard Time
PST:Pacific Standard Time
EST:Eastern Standard Time
它指的是Q星期一 东部旉8?中部旉7炏V两地同时播放,不过因ؓ时差问题Q钟表上昄的时间有一个小时的差别?br>管官网的播放时间对于美国以外的朋友来说意义不大Q不q如果你愿意查出相对应的北京旉Q可以?a >http://www.worldtimeserver.com 的服务,我相信国内也有很多类似的旉转换|站Q包括googleQ百度都可以Q这里就不再|嗦了。至目前来_东旉和北京时间相?2时Q也是_我们比美东快12个小时。Prison Break的播放时间就是北京时间第二天的早?点,也就是星期二 8:00AM.
中部标准时区 (Central Standard Time; CST; UTC-6; S?Q包括密西西比河沿岸以及以西州䆾的大部䆾?
山部标准时区 (Mountain Standard Time; MST; UTC-7; T?, 沿大陆分水岭—洛矶山一U的州䆾、大盆地及科|拉多河l?
太^z标准时?(Pacific Standard Time; PST; UTC-8; U?Q包括太qx沿岸地区及内华达州?/p>
夏威夷—阿留申时区 (Hawaii-Aleutian Standard TimeQ非正式Q夏威夷标准?Hawaii Standard Time; HST; UTC-10; W?Q包括夏威夷州及169°30'W以西的阿留申岛?
萨摩亚时?(Samoa Standard Time; UTC-11, X?包括属萨摩亚?
查莫|时?(Chamorro Standard Time; UTC+10, Zone K)包括兛_及北马里亚纳岛?/p>
1昆仑时区 UTC+5.5 新疆襉K与部分西?br>2新藏时区 UTC+6 新疆及西?br>3陇蜀时区 UTC+7 中国中部
4中原标准时区 UTC+8 中国岸
5长白时区 UTC+9 中国东北
1949q之后,中国大陆?#8220;中原标准旉”改称“北京旉”Qƈ在全国统一使用该时间作为标准时间。台湑ֈl持“中原标准旉”之名Uͼ也有U?#8220;台北旉”?#8220;国家标准旉”?/p>
]]>
//创徏标准目录模板
mvn archetype:create -DgroupId=com.codeline.commons -DartifactId=codelineCommons
//创徏web目
mvn archetype:create -DgroupId=com.mycompany.app -DartifactId=my-webapp -DarchetypeArtifactId=maven-archetype-web
mvn -Dplugin=groupId:artifactId help:describe
mvn -Dmaven.test.skip=true
-Dfile=<path-to-file>
-DgroupId=<group-id>
-DartifactId=<artifact-id>
-Dversion=<version>
-Dpackaging=<packaging>
-DgeneratePom=true
compileQ编译项目的源代码?
test-compileQ编译项目测试代码?
testQ用已~译的测试代码,试已编译的源代码?
packageQ已发布的格式,如jarQ将已编译的源代码打包?
integration-testQ在集成试可以q行的环境中处理和发布包?
verifyQ运行Q何检查,验证包是否有效且辑ֈ质量标准?
installQ把包安装在本地的repository中,可以被其他工E作Z赖来使用
deployQ在整合或者发布环境下执行Q将最l版本的包拷贝到q程的repositoryQ得其他的开发者或者工E可以共享?
generate-sourcesQ生应用需要的M额外的源代码Q如xdoclet?
compileQ缺省|适用于所有阶D,会随着目一起发布?
providedQ类似compileQ期望JDK、容器或使用者会提供q个依赖。如servlet.jar?
runtimeQ只在运行时使用Q如JDBC驱动Q适用q行和测试阶Dc?
testQ只在测试时使用Q用于编译和q行试代码。不会随目发布?
systemQ类似providedQ需要显式提供包含依赖的jarQMaven不会在Repository中查扑֮
egQ?br /> <dependency>
<groupId>hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
]]> int curIndex = 0;
AuditQueueEntry aqe;
synchronized (localCriticalSection)
{
while (curIndex < theList.size())
{
aqe = (AuditQueueEntry) theList.get(curIndex);
if (aqe.getTrailId() == theTrailId)
{
theList.remove(curIndex);
} else
{
curIndex++;
}
}
}
localCriticalSection做ؓ一个信号量来控制程序对cL员变量theList的访问,从而保证了theList在同一旉只有一个程序访问。运行程序,q个函数p了将q?U钟。同步是很耗时间的?br />在java.util.Collections中提供了很多Ҏ来保证集合(数组Q的同步讉K?br />我们修改cL员变量theList的实例化ҎQ?br />theList = Collections.synchronizedList(new LinkedList());
再修改处理函敎ͼ int curIndex = 0;
AuditQueueEntry aqe;
// synchronized (localCriticalSection) {
synchronized(theList)
{
while (curIndex < theList.size())
{
aqe = (AuditQueueEntry) theList.get(curIndex);
if (aqe.getTrailId() == theTrailId)
{
theList.remove(curIndex);
} else
{
curIndex++;
}
}
}
再运行,q个函数才花费将q一U钟的时_
在Collections中提供了很多q类的方法?img src ="http://www.tkk7.com/swingboat/aggbug/80363.html" width = "1" height = "1" />
]]>
2.cof/server.xml的配|?egQC:\jakarta-tomcat-5.5.7\conf)?/p>
<Resource name="jdbc/opdb" auth="Steve" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" username="test" password="oracle" maxActive="20" maxIdle="10" maxWait="10000"/>
3.web/META-INF/content.xml的配|?/p>
<?xml version='1.0' encoding='utf-8'?>
<Context>
<!-- note: the following resource name is set up to use the inet jdbc driver. If you are
using a different driver, then you will have to change the driverClassName.
You will have to change the url (the ip and db identifier part), username and password
entries for your environment.
-->
<Resource name="jdbc/opdb" auth="Container" type="javax.sql.DataSource" username="test" password="oracle"
driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@172.16.208.190:1522:opdb" maxActive="20" maxIdle="10"
maxWait="-1" validationQuery="SELECT 1 FROM DUAL"/>
</Context>
说明Q我的tomcat版本?.5.7。好像必配|content.xml文gQ但是配了这个文Ӟserver.xml中的讄不v作用了。下面是各参数的说明Q?br />driveClassNameQJDBC驱动cȝ完整的名Uͼ
maxActiveQ同时能够从q接池中被分配的可用实例的最大数Q?
maxIdleQ可以同旉|在q接池中的连接的最大数Q?
maxWaitQ最大超时时_以毫U计Q?
passwordQ用户密码;
urlQ到JDBC的URLq接Q?
userQ用户名Uͼ
validationQueryQ用来查询池中空闲的q接?br />
<servlet>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet>
<servlet-name>SOAPMonitorService</servlet-name>
<servlet-class>org.apache.axis.monitor.SOAPMonitorService</servlet-class>
<init-param>
<param-name>SOAPMonitorPort</param-name>
<param-value>5001</param-value>
</init-param>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SOAPMonitorService</servlet-name>
<url-pattern>/SOAPMonitor</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>5</session-timeout>
</session-config>
<mime-mapping>
<extension>wsdl</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<mime-mapping> 5.客户端调?BR> String endpoint = "http://localhost:" + "8080" Service service = new Service(); String res = (String) call.invoke(new Object[] {""});//object数组E方法的参数 System.out.println(res);
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
4.服务发布Qjws文g发布和定制发布)
a、jws文g发布
在web应用E序目录下,新徏一个jws文gQ例如:Hello.jws文gQ其实就是个java文gQ不包含包名Q?nbsp;
public class Hello {
public String hello(String name){
if(name==null){
name="";
}
return "Hi,你好 "+name+",Ƣ迎来到Web服务世界Q?;
}
}
q样可以直接查看hello服务相应的wsdl了:http://localhost:8080/testaxis/hello.jws?wsdl
b.定制发布?BR> 定制发布Q依赖一个server-confif.wsdd文g?BR> 在web-inf目录下新Z个deploy.wsdd文gQ设|发布的服务Q例如:
<deployment xmlns=" xmlns:java=" <service name="city" provider="java:RPC">
<parameter name="className" value="yhp.test.axis.service.CityService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
利用axis提供的工P可以生成server-confif.wsdd文g了:
java -cp %AXISCLASSPATH% org.apache.axis.client.AdminClient deploy.wsdd
在运行过E中发现Q如果没有把axis自带的应用发布到服务器上Q运行时会提C?04的错?未发现axis/servlet/AxisServlet?/P>
+ "/testaxis/services/city"; //以定制发布方式,如果是jws文gQ则endpoint为相应的jws文g
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(endpoint));
call.setOperationName("getZip");
6.生成客户端stub相关c?BR> Axis提供了工L成客Lstub相关的类Q即通过wsdl产生stub?BR> java -cp %AXISCLASSPATH% org.apache.axis.wsdl.WSDL2Java http://localhost:8080/testaxis/services/city?wsdl
]]>
public Object clone(){
Outbound2splitVO o = null;
try{
o = (Outbound2splitVO)super.clone();
}catch(CloneNotSupportedException e){
e.printStackTrace();
}
return o;
}
}
cdd现Cloneable接口QcloneҎ?/P>
当元素的序很重要时选用TreeMapQ当元素不必以特定的序q行存储Ӟ使用HashMap。Hashtable的用不被推荐,因ؓHashMap提供了所有类似的功能Qƈ且速度更快。当你需要在多线E环境下使用ӞHashMap也可以{换ؓ同步的?
以下引用Q? |
当你事先不知道要存放数据的个敎ͼ或者你需要一U比数组下标存取机制更灵zȝҎӞ你就需要用到集合类?/P>
集合cd放于java.util包中? (1)? (2)列表 (3)映射
java.util中共?3个类可用于管理集合对象,它们支持集、列表或映射{集合,以下是这些类的简单介l?/P> 集: 下图是集合类所实现的接口之间的关系Q? Set和List都是由公共接口Collection扩展而来Q所以它们都可以使用一个类型ؓCollection的变量来引用。这意味着M列表或集构成的集合都可以用这U方式引用,只有映射c除外(但也不是完全排除在外Q因为可以从映射获得一个列表。)所以说Q把一个列表或集传递给Ҏ的标准途径是用Collectioncd的参数?/P> |
׃jspsmartupload上传文gQ当前端面没有file控gӞ后端用jspsmartupload控gupload时将会走入一个死循环。现在采用struts自己提供的功能实现文件的上传?BR>1、前端页面upload.jsp
<html:form action="/filesave.do" styleId="formItem" method="post" enctype="multipart/form-data">
<INPUT class='input-file' type="file" name="theFile">
</html:form>
2、struts-config.xml文g配置
<form-bean name="UploadForm" type="yhp.test.web.UploadForm" />
<action input="/upload.jsp" name="UploadForm" path="/filesave" scope="request" type="yhp.test.web.UploadAction" validate="false">
<forward name="success" path="/success.jsp" />
<forward name="error" path="/error.jsp" />
</action>
3、UploadForm.java文g
package yhp.test.web;
import org.apache.struts.upload.FormFile;
import org.apache.struts.action.ActionForm;
public class UploadForm extends ActionForm {
protected String theText; //使用protected ,其它需要上传的form可以l承此form
protected boolean writeFile = true;
protected FormFile theFile;
protected String filePath;
public String getTheText() {
return theText;
}
public void setTheText(String theText) {
this.theText = theText;
}
public FormFile getTheFile() {
return theFile;
}
public void setTheFile(FormFile theFile) {
this.theFile = theFile;
}
public void setWriteFile(boolean writeFile) {
this.writeFile = writeFile;
}
public boolean getWriteFile() {
return writeFile;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getFilePath() {
return filePath;
}
public void reset() {
writeFile = false;
}
}
4、UploadAction.java文g
package yhp.test.web;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.upload.FormFile;
public class UploadAction extends Action {
public ActionForward execute(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest httpServletRequest,
HttpServletResponse httpServletResponse) throws
Exception {
if (actionForm instanceof UploadForm) {
// 获取上传的目?BR> String path = getServlet().getServletContext().getInitParameter("UPLOADPATH");
File f = new File(path);
if (!f.isDirectory()) {
f.mkdir();
}
UploadForm theForm = (UploadForm) actionForm;
String text = theForm.getTheText();
FormFile file = theForm.getTheFile();
String fileName = file.getFileName();
String contentType = file.getContentType();
boolean writeFile = theForm.getWriteFile();
String desFileName=path fileName ;
String size = (file.getFileSize() + " bytes");
try {
InputStream stream = file.getInputStream();
OutputStream bos = new FileOutputStream(strFileName);
byte[] buffer = new byte[file.getFileSize()];
stream.read(buffer);
bos.write(buffer);
stream.close();
bos.close();
return actionMapping.findForward("success");
}
catch (FileNotFoundException fnfe) {
return actionMapping.findForward("success");
}
catch (IOException ioe) {
return actionMapping.findForward("success");
}
catch(Exception eo){
return actionMapping.findForward("error");
}
}else{
return actionMapping.findForward("error");
}
}
}
背景Q当我们写完一个类的时候,需要对cȝ某些Ҏq行试。我以前的做法是在类的main函数中,new一个类的实例,然后调用cȝҎq行试。当需要测试的Ҏ来较多的时候,main函数也在逐渐的变大,最后连自己都糊涂了。这时候就需要junit了?BR>~码原则Q?BR> 从技术上强制你先考虑一个类的功能,也就是这个类提供l外部的接口Q而不至于太早陷入它的l节。这是面向对象提倡的一U设计原则?BR>如果你要写一D代码:
1. 先用 junit 写测试,然后再写代码
2. 写完代码Q运行测试,试p|
3. 修改代码Q运行测试,直到试成功
~写步骤Q如下图
试代码Q?BR>package yhp.test.junit;
import junit.framework.*;
public class TestCar extends TestCase {
protected int expectedWheels;
protected Car myCar;
public TestCar(String name) {
super(name);
}
protected void setUp(){ //q行初始化Q?BR> expectedWheels = 4;
myCar = new Car();
}
public static Test suite() {//JUnit的TestRunner会调用suiteҎ来确定有多少个测试可以执?BR> return new TestSuite(TestCar.class);
}
public void testGetWheels(){//以test开_注意命名
assertEquals(expectedWheels, myCar.getWheels());
}
}
以下是通过eclipse自带的junit工具产生的代码:
package yhp.test.junit;
import junit.framework.TestCase;
public class TestCar2 extends TestCase {
protected int expectedWheels;
protected Car myCar;
public static void main(String[] args) {
junit.textui.TestRunner.run(TestCar2.class);//TestCar是个Ҏsuite的静态方?BR> }
protected void setUp() throws Exception {
super.setUp();
expectedWheels = 4;
myCar = new Car();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public TestCar2(String arg0) {
super(arg0);
}
public final void testGetWheels() {
assertEquals(expectedWheels, myCar.getWheels());
}
}
当有多个试cȝ时候,pȝ能进行统一试Q这时可以利用TestSuite来实现。可以将TestSuite看作是包Ҏ试的一个容器?BR>通过eclipse自带的工L成的代码如下Q?BR>package yhp.test.junit;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite suite = new TestSuite("Test for yhp.test.junit");
//$JUnit-BEGIN$
suite.addTest(TestCar.suite()); //调用的方法,参数不一P实际是一致的?BR> suite.addTestSuite(TestCar2.class); //
//$JUnit-END$
return suite;
}
}