日期:2014-05-20  浏览次数:20902 次

请教一个Java测试类的“出现预期不符”的原因.
我写了一个Java的测试类:
    代码如下:
    
package s_port_package_BeiJing;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.HashMap;

public class D_port_SysUserClient_DS {
static long nowintervaltime = 0;
int times = 0;
boolean bool = true;
HashMap<Integer,Socket> socketmap = new HashMap<Integer,Socket>(ChatServer.MyMEMNum);
long registeredintervalTime = 0;
long bufferintervalTimestart = 0;
    long bufferintervalTimenow = 0;
    Integer MyLocalSysNum = 0;
boolean isInbufferTime = false;
boolean isOutOfAuthorizeTime = false;
boolean onlineInfo = false;
static String MyMemberUID = null;
static String SysFicia = null;
static String MyMemberPWD = null;
String MyMemberPhoneNum = null;
Socket Myso1 = null;
String[] Databuffer = null;
String MyPhoneNum = null;
String MyRole = null;
String MyPhysicalPlace = null;
Integer myIndex = -1;
ChatServer Localdemo = null;
public String UsernameLocal = null;
boolean isreply = false;
String IPAddress = null;
static int orderformnumDoctor = 0;
DataOutputStream Mydops = null;
int Localonline = 0;
int Clientnum = 0;
Integer MySysNum = 199999999;
String MyroleLocal = "";
Integer ChatObjectUIDLocal = -1;
MyChatingObjHashMap MyFriendMemConditionlist = new MyChatingObjHashMap();
MyChatingObjHashMap MyFriendCusConditionlist = new MyChatingObjHashMap();
static int orderformnumCustomer = 0;
String MyObjRole = null;
GetUserIndex cjco = new GetUserIndex();

public static void main(String[] args){
Socket so = null;
try {
so = new Socket("127.0.0.1",8888);
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
new D_port_SysUserClient_DS(so,true,9,"127.0.0.1");
}

public void setMyIP(ArrayList<String> IP){
IPAddress = IP.get(0);
IP.clear();
}

public D_port_SysUserClient_DS(int Num,String UID,String PWD){
MySysNum = new Integer(Num);
MyMemberUID = UID;
MyMemberPWD = PWD;
}

public D_port_SysUserClient_DS(String Num,String MyPlace,String Role){
MySysNum = Integer.parseInt(Num);
MyPhysicalPlace = MyPlace;
MyRole = Role;
}

public D_port_SysUserClient_DS(int Num,long registeredTimesegment,String UID,String PWD,String Ficia,String MyPlace,String Role){
registeredintervalTime = registeredTimesegment;
MySysNum = new Integer(Num);
MyMemberUID = UID;
MyMemberPWD = PWD;
SysFicia = Ficia;
MyRole = Role;
}

public D_port_SysUserClient_DS(int Num,long registeredTimesegment,String UID,String PWD,String Ficia,Socket s){
registeredintervalTime = registeredTimesegment;
MySysNum = new Integer(Num);
MyMemberUID = UID;
MyMemberPWD = PWD;
SysFicia = Ficia;
MyMemberPhoneNum = Databuffer[5];
Myso1 = s;
}

public D_port_SysUserClient_DS(long startTime,boolean needAuthorize){
bufferintervalTimestart = startTime;
isInbufferTime = needAuthorize;
}

public void setTimenow(long nowTime){
bufferintervalTimenow = nowTime;
}

public D_port_SysUserClient_DS(Socket s,boolean online,Integer MySysNumInfo,String IP){
Myso1 = s;
onlineInfo = online;
MySysNum = MySysNumInfo;
IPAddress = IP;
System.out.println(MySysNum);
System.out.println(Myso1);
socketmap.put(MySysNum, Myso1);
if(bool){
for(int i =0;i<202;i++){
MyFriendMemConditionlist.put(i, false);
System.out.println("褚留香!!加油!!"+MyFriendCusConditionlist.get(i));
}
for(int i =0;i<200;i++){
MyFriendCusConditionlist.put(i, true);
}
bool = false;
}
}

public D_port_SysUserClient_DS(String Ficia){
SysFicia = Ficia;
}

public long returnMyregisterTime(Integer num){
return registeredintervalTime;
}

public void putSocket(Integer MyWorkNum,Socket so){