?? commonutiltest.java
字號:
package com.yayisoft.sso.util;
import junit.framework.Assert;
import junit.framework.TestCase;
public class CommonUtilTest extends TestCase {
static String apply = "";
static String applyStrips = "";
static String intro = "";
static String introStrips = "";
static String enUser = "";
static String deUser = "";
static String tips = "";
protected void setUp() throws Exception {
super.setUp();
}
public void testGetGuid() {
String s = CommonUtil.getGuid();
apply = CommonUtil.getGuid();
System.out.println("apply:"+apply);
intro = CommonUtil.getGuid();
System.out.println("intro:"+intro);
System.out.println("------------------testGetGuid-----------------ok");
Assert.assertNotNull(s);
}
public void testGetStripsByIntro() {
try {
String strips = CommonUtil.getStripsByIntro(intro);
introStrips = strips;
System.out.println("introStrips:" + introStrips);
System.out.println("------------------testGetStripsByIntro-----------------ok");
Assert.assertNotNull(strips);
} catch (SSOException e) {
e.printStackTrace();
}
}
public void testCheckIntro() {
try {
boolean b = CommonUtil.checkIntro(intro, introStrips);
System.out.println("testCheckIntro:" + b);
System.out.println("------------------testCheckIntro-----------------ok");
Assert.assertTrue(b);
} catch (SSOException e) {
e.printStackTrace();
}
}
public void testGetStripsByApply() {
try {
String strips = CommonUtil.getStripsByApply(apply);
applyStrips = strips;
System.out.println("applyStrips:" + applyStrips);
System.out.println("------------------testGetStripsByApply-----------------ok");
Assert.assertNotNull(strips);
} catch (SSOException e) {
e.printStackTrace();
}
}
public void testCheckApply() {
try {
boolean b = CommonUtil.checkApply(apply, applyStrips);
System.out.println("testCheckApply:" + b);
System.out.println("------------------testCheckApply-----------------ok");
Assert.assertTrue(b);
} catch (SSOException e) {
e.printStackTrace();
}
}
public void testEncryptUser() {
try {
enUser = CommonUtil.EncryptUser("MeadLai", apply, intro);
System.out.println("enUser:" + enUser);
System.out.println("------------------testEncryptUser-----------------ok");
Assert.assertNotNull(enUser);
} catch (SSOException e) {
System.out.println("############testEncryptUser*******************failed");
e.printStackTrace();
}
}
public void testGetTipsByTokon() {
try {
tips = CommonUtil.getTipsByTokon(enUser);
System.out.println("tips:" + tips);
System.out.println("------------------testGetTipsByTokon-----------------ok");
Assert.assertNotNull(tips);
} catch (SSOException e) {
System.out.println("############testGetTipsByTokon*******************failed");
e.printStackTrace();
}
}
public void testCheckTips() {
try {
boolean b = CommonUtil.checkTips(enUser, tips);
System.out.println("b:" + b);
System.out.println("------------------testCheckTips-----------------ok");
Assert.assertTrue(b);
} catch (SSOException e) {
System.out.println("############testCheckTips*******************failed");
e.printStackTrace();
}
}
public void testDecryptUser() {
try {
deUser = CommonUtil.DecryptUser(enUser, apply, intro);
System.out.println("deUser" + deUser);
System.out.println("------------------testDecryptUser-----------------ok");
Assert.assertNotNull(deUser);
} catch (SSOException e) {
System.out.println("############testDecryptUser*******************failed");
e.printStackTrace();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -