Android Open Source - KnowledgeBase Conversion Test






From Project

Back to project page KnowledgeBase.

License

The source code is released under:

MIT License

If you think the Android project KnowledgeBase listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.martin.knowledgebase;
//w w w .  ja v  a 2 s  .c o  m
import android.test.AndroidTestCase;

import java.util.ArrayList;

public class ConversionTest extends AndroidTestCase {

    private ArrayList<Entry> entries;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        entries = new ArrayList<Entry>();
        entries.add(new Entry("Title", "Text here", "2015-01-04"));
        entries.add(new Entry("Title2", "Text here2", "2015-01-05"));
        entries.add(new Entry("Title3", "Text here3", "2015-01-06"));
    }

    public void testStringify() throws Exception {
        String string = Util.stringify(entries);
        assertEquals("Not the same:", "Title-INNER-Text here-INNER-2015-01-04-OUTER-Title2-INNER-Text here2-INNER-2015-01-05-OUTER-Title3-INNER-Text here3-INNER-2015-01-06", string);
    }

    public void testEquals() throws Exception {
        ArrayList<Entry> entries1 = new ArrayList<Entry>();
        entries1.add(new Entry("Title", "Text here", "2015-01-04"));

        ArrayList<Entry> entries2 = new ArrayList<Entry>();
        entries2.add(new Entry("Title", "Text here", "2015-01-04"));

        assertEquals("Not the same:", entries1, entries2);

        /*ArrayList<String> list1 = new ArrayList<String>();
        list1.add("Hey");

        ArrayList<String> list2 = new ArrayList<String>();
        list2.add("Hey");

        assertEquals("Not the same:", list1, list2);*/
    }

    public void testListify() throws Exception {
        ArrayList<Entry> second = Util.listify(Util.stringify(entries));
        assertEquals("Not the same:", entries, second);
    }
}




Java Source Code List

com.martin.knowledgebase.ConversionTest.java
com.martin.knowledgebase.EditActivity.java
com.martin.knowledgebase.EncryptionTest.java
com.martin.knowledgebase.EntryTest.java
com.martin.knowledgebase.Entry.java
com.martin.knowledgebase.LoginActivity.java
com.martin.knowledgebase.MainActivity.java
com.martin.knowledgebase.PlainStorage.java
com.martin.knowledgebase.Snackbar.java
com.martin.knowledgebase.Util.java
com.tozny.crypto.android.AesCbcWithIntegrity.java