diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-01-26 00:59:23 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-01-26 00:59:23 +0100 |
commit | 7b83533249d6cbb20e5491a3f11f0305c645ec20 (patch) | |
tree | ce498921b74553e64aff254fa6202b681d9cfb4b /src/test/groovy/org | |
parent | 08b882f4cf284bed3f8f80f6e47d37037753a22b (diff) | |
download | glocals-classifieds-7b83533249d6cbb20e5491a3f11f0305c645ec20.tar.gz glocals-classifieds-7b83533249d6cbb20e5491a3f11f0305c645ec20.zip |
cleanup
Diffstat (limited to 'src/test/groovy/org')
-rw-r--r-- | src/test/groovy/org/xapek/yvesf/classifieds/UnitTest.groovy | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/test/groovy/org/xapek/yvesf/classifieds/UnitTest.groovy b/src/test/groovy/org/xapek/yvesf/classifieds/UnitTest.groovy new file mode 100644 index 0000000..7c477b4 --- /dev/null +++ b/src/test/groovy/org/xapek/yvesf/classifieds/UnitTest.groovy @@ -0,0 +1,47 @@ +package org.xapek.yvesf.classifieds + +import org.junit.Test +import org.xapek.yvesf.classifieds.util.Success + +class UnitTest { + @Test + void testRead() { + final data = Main.readInputStream(UnitTest.getResourceAsStream('test.json')) + assert data instanceof Map + } + + @Test + void testParse() { + final data = Main.handleData(Main.readInputStream(UnitTest.getResourceAsStream('test.json'))) + assert data instanceof Success + assert data.success + assert !data.error + assert data.value instanceof Model.ClassifiedsList + assert data.value.totalCount > 0 + assert data.value.size() > 0 + } + + @Test + void testDump() { + final os = new ByteArrayOutputStream() + final list = new Model.ClassifiedsList(totalCount: 100) + list.add(new Model.Classified([ + 'available' : 'value=available', + 'location' : 'value=location', + 'city' : 'value=city', + 'type' : 'value=type', + 'price' : 'value=price', + 'currency' : 'value=currency', + 'views' : 'value=views', + 'title' : 'value=title', + 'id' : 'value=id', + 'mem_name' : 'value=mem_name', + 'description': 'value=description', + ])) + Dumper.dump(list, new PrintWriter(os)) + final output = os.toString() + assert output.contains("value=city") + assert output.contains("value=title") + assert output.contains("value=description") + } +}
\ No newline at end of file |