Skip to content

Commit

Permalink
优化测试代码
Browse files Browse the repository at this point in the history
  • Loading branch information
ronghao committed Aug 25, 2017
1 parent 25a1324 commit d2621d0
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions app/src/main/java/com/haohaohu/cachemanagesample/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@ protected void onCreate(Bundle savedInstanceState) {
}

private void init() {
// CacheUtil.init(MainActivity.this);
//CacheUtil.init(MainActivity.this, "WLIJkjdsfIlI789sd87dnu==", "haohaoha");

CacheUtilConfig cc = CacheUtilConfig.builder(MainActivity.this)
.setDes3("WLIJkjdsfIlI789sd87dnu==")
.setIv("haohaoha")
//.setDes3("WLIJkjdsfIlI789sd87dnu==")
//.setIv("haohaoha")
.build();
CacheUtil.init(cc);

Expand All @@ -62,18 +59,12 @@ public void onClick(View v) {
String value = new StringBuilder().append("不加密字符串测试:")
.append(check("测试数据1", CacheUtil.get("key1")))
.append("\n")
.append(check("测试数据1 文本内容:", CacheUtil.get("key1", false)))
.append("\n")
.append("加密字符串测试:")
.append(check("测试数据2", CacheUtil.get("key2", true)))
.append("\n")
.append(check("测试数据2 文本内容:", CacheUtil.get("key2", false)))
.append("\n")
.append("不加密字符串测试:")
.append(check("测试数据18", CacheUtil.get("key18", false)))
.append("\n")
.append(check("不加密字符串测试 文本内容:", CacheUtil.get("key18", false)))
.append("\n")
.append("特殊字符串测试:")
.append(check("~!@#$%^&*()_+{}[];':,.<>`", CacheUtil.get("key3")))
.append("\n")
Expand Down Expand Up @@ -128,7 +119,7 @@ public void onClick(View v) {
findViewById(R.id.text1).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
CacheUtil.put("key1", "测试数据1");//默认不加密
CacheUtil.put("key1", "测试数据1");//默认加密状态
CacheUtil.put("key2", "测试数据2", true);//true代表加密存储
CacheUtil.put("key3", "~!@#$%^&*()_+{}[];':,.<>`");//特殊字符串测试
CacheUtil.put("key4", "~!@#$%^&*()_+{}[];':,.<>`", true);//加密特殊字符串测试
Expand Down

0 comments on commit d2621d0

Please sign in to comment.