From 801e99743d1a2ecda4d4d286cf63ee4fbedf9e35 Mon Sep 17 00:00:00 2001 From: Sunguk Lee Date: Tue, 12 Nov 2013 02:15:30 +0900 Subject: [PATCH 1/2] Fix unittests * AccountDbTest should required valid running order. but JUnit do random order or failure first run * WhooingSmsTest require SuppressWarnings annotation --- .../net/wisedog/android/whooing/sms/test/AccountDbTest.java | 3 --- .../net/wisedog/android/whooing/sms/test/WhooingSmsTest.java | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/src/net/wisedog/android/whooing/sms/test/AccountDbTest.java b/tests/src/net/wisedog/android/whooing/sms/test/AccountDbTest.java index 5acdbcc..b5b74ff 100644 --- a/tests/src/net/wisedog/android/whooing/sms/test/AccountDbTest.java +++ b/tests/src/net/wisedog/android/whooing/sms/test/AccountDbTest.java @@ -89,9 +89,6 @@ public void testAddAllAccountEntity(){ assertEquals("내카드", info.title); assertEquals("creditcard", info.category); assertEquals(20990101, info.close_date); - } - - public void testGetAllRecord(){ ArrayList array = mDb.getAllRecord(); assertEquals(4, array.size()); } diff --git a/tests/src/net/wisedog/android/whooing/sms/test/WhooingSmsTest.java b/tests/src/net/wisedog/android/whooing/sms/test/WhooingSmsTest.java index 9b6d395..66d4602 100644 --- a/tests/src/net/wisedog/android/whooing/sms/test/WhooingSmsTest.java +++ b/tests/src/net/wisedog/android/whooing/sms/test/WhooingSmsTest.java @@ -33,6 +33,7 @@ public class WhooingSmsTest extends ActivityInstrumentationTestCase2 private ListView mListView; private TextView mTextBoard; + @SuppressWarnings("deprecation") public WhooingSmsTest(){ super("net.wisedog.android.whooing.sms.activity.WhooingSms", WhooingSms.class); } @@ -58,7 +59,7 @@ public void testPreconditions(){ } public void testBoardText(){ - int itemCount = mListView.getAdapter().getCount(); + int itemCount = mListView.getCount(); String msg = mTextBoard.getText().toString(); String msgNoData = mActivity.getString( net.wisedog.android.whooing.sms.R.string.whoochoo_sms_board_no_data); From 2a05591f6d94b8e221c27ef575af6291b0591ec6 Mon Sep 17 00:00:00 2001 From: Sunguk Lee Date: Tue, 12 Nov 2013 01:05:34 +0900 Subject: [PATCH 2/2] Add IBK checkcard support * Add unittest * Add new fields - KEY_INOUT: incoming/outgoing - KEY_CARDNUMBER --- .../android/whooing/sms/br/SmsFilter.java | 14 +++++++++++ .../android/whooing/sms/br/SmsFilterData.java | 11 +++++---- .../whooing/sms/test/SmsFilterTest.java | 24 +++++++++++++++++++ 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/src/net/wisedog/android/whooing/sms/br/SmsFilter.java b/src/net/wisedog/android/whooing/sms/br/SmsFilter.java index d85017d..ebb925b 100644 --- a/src/net/wisedog/android/whooing/sms/br/SmsFilter.java +++ b/src/net/wisedog/android/whooing/sms/br/SmsFilter.java @@ -25,8 +25,12 @@ public class SmsFilter { static public final String KEY_ITEM = "item"; static public final String KEY_CARDNAME = "cardname"; + static public final String KEY_INOUT = "inout"; + static public final int TYPE_INOUT_INCOMING = 1; + static public final int TYPE_INOUT_OUTGOING = 2; static public final String KEY_DATE = "date"; static public final String KEY_MONEY = "money"; + static public final String KEY_CARDNUMBER = "cardnumber"; static public final String KEY_CHECKCARD = "checkcard"; /** @@ -145,6 +149,16 @@ public Bundle filterMessage(String msg, int cardCode){ } break; + case SmsFilterData.CODE_IBK: + b = new Bundle(); + b.putInt(KEY_DATE, WhooingSmsUtil.convertWhooingDate(tokens[0])); + b.putString(KEY_ITEM, tokens[6]); + b.putInt(KEY_MONEY, convertToInt(tokens[3])); + b.putInt(KEY_INOUT, tokens[2].equals("출금") ? TYPE_INOUT_OUTGOING : TYPE_INOUT_INCOMING); + b.putString(KEY_CARDNUMBER, tokens[7]); + b.putBoolean(KEY_CHECKCARD, true); + break; + default: break; } diff --git a/src/net/wisedog/android/whooing/sms/br/SmsFilterData.java b/src/net/wisedog/android/whooing/sms/br/SmsFilterData.java index 3a548e0..a3660b8 100644 --- a/src/net/wisedog/android/whooing/sms/br/SmsFilterData.java +++ b/src/net/wisedog/android/whooing/sms/br/SmsFilterData.java @@ -27,6 +27,7 @@ public class SmsFilterData { static public final int CODE_SHINHAN = 8; static public final int CODE_HANA = 9; static public final int CODE_NH = 10; + static public final int CODE_IBK = 11; static public final String[] CARD_COMPANY_NAME = { "", @@ -39,22 +40,24 @@ public class SmsFilterData { "현대카드", "신한카드", "하나SK카드", - "농협카드" + "농협카드", + "기업은행" }; // Be sure to check that below order and upper constants must be matched. static public final String[] SENDER_NUMBER = { "", // None - "15886700", //외환 + "15886700", //외환 "15888900", //삼성 "15888300", //롯데 "15881688", //KB "15889955", //우리 - "15884000", //우리체크 + "15884000", //우리체크 "15776200", //현대 "15447200", //신한 "15991155", //하나 - "15881600" //농협 + "15881600", //농협 + "15662566", //기업 }; } diff --git a/tests/src/net/wisedog/android/whooing/sms/test/SmsFilterTest.java b/tests/src/net/wisedog/android/whooing/sms/test/SmsFilterTest.java index e3ebb8a..20ac92d 100644 --- a/tests/src/net/wisedog/android/whooing/sms/test/SmsFilterTest.java +++ b/tests/src/net/wisedog/android/whooing/sms/test/SmsFilterTest.java @@ -164,4 +164,28 @@ public void testFilterMsgHyundai(){ assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false)); } + public void testFilterMsgIBKOutgoing(){ + Bundle b = mFilter.filterMessage("11/06 18:06\n출금 530,463원\n잔액 2,256,323원\nGOOGLE\n123***12312300\n기업", SmsFilterData.CODE_IBK); + assertNotNull(b); + + assertEquals(20131106, b.getInt(SmsFilter.KEY_DATE, -1)); + assertEquals("GOOGLE", b.getString(SmsFilter.KEY_ITEM)); + assertEquals(530463, b.getInt(SmsFilter.KEY_MONEY)); + assertEquals(SmsFilterData.CODE_IBK, b.getInt(SmsFilter.KEY_CARDNAME, -1)); + assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false)); + assertEquals(SmsFilter.TYPE_INOUT_OUTGOING, b.getInt(SmsFilter.KEY_INOUT, -1)); + assertEquals("123***12312300", b.getString(SmsFilter.KEY_CARDNUMBER)); + } + public void testFilterMsgIBKIncoming(){ + Bundle b = mFilter.filterMessage("10/15 09:57\n입금 3,114원\n잔액 5,016,561원\n체크입금\n123***12312300\n기업", SmsFilterData.CODE_IBK); + assertNotNull(b); + + assertEquals(20131015, b.getInt(SmsFilter.KEY_DATE, -1)); + assertEquals("체크입금", b.getString(SmsFilter.KEY_ITEM)); + assertEquals(3114, b.getInt(SmsFilter.KEY_MONEY)); + assertEquals(SmsFilterData.CODE_IBK, b.getInt(SmsFilter.KEY_CARDNAME, -1)); + assertEquals(true, b.getBoolean(SmsFilter.KEY_CHECKCARD, false)); + assertEquals(SmsFilter.TYPE_INOUT_INCOMING, b.getInt(SmsFilter.KEY_INOUT, -1)); + assertEquals("123***12312300", b.getString(SmsFilter.KEY_CARDNUMBER)); + } }