From ba5b309d8f42c6cb2e758758ff0104da44ef575d Mon Sep 17 00:00:00 2001 From: Stefan Niedermann Date: Fri, 23 Oct 2015 11:48:15 +0200 Subject: [PATCH] Fix Unit Tests --- .../it/niedermann/owncloud/notes/util/NoteUtilTest.java | 8 ++++++-- .../owncloud/notes/util/NotesClientUtilTest.java | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NoteUtilTest.java b/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NoteUtilTest.java index 0fedfb64..5d45fcb0 100644 --- a/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NoteUtilTest.java +++ b/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NoteUtilTest.java @@ -25,9 +25,10 @@ public class NoteUtilTest extends TestCase { assertEquals("Test", NoteUtil.getLineWithoutMarkDown("Test", 0)); assertEquals("Test", NoteUtil.getLineWithoutMarkDown("\nTest", 0)); assertEquals("Foo", NoteUtil.getLineWithoutMarkDown("Foo\nBar", 0)); + assertEquals("Bar", NoteUtil.getLineWithoutMarkDown("Foo\nBar", 1)); } - public void testGenerateTitle() { + public void testGenerateNoteTitle() { assertEquals("Test", NoteUtil.generateNoteTitle("Test")); assertEquals("Test", NoteUtil.generateNoteTitle("Test\n")); assertEquals("Test", NoteUtil.generateNoteTitle("Test\nFoo")); @@ -35,7 +36,10 @@ public class NoteUtilTest extends TestCase { assertEquals("Test", NoteUtil.generateNoteTitle("\n\nTest")); } - public void testGenerateExcerpt() { + public void testGenerateNoteExcerpt() { assertEquals("Test", NoteUtil.generateNoteExcerpt("Test")); + assertEquals("Foo", NoteUtil.generateNoteExcerpt("Test\nFoo")); + assertEquals("Foo", NoteUtil.generateNoteExcerpt("Test\nFoo\nBar")); + assertEquals("", NoteUtil.generateNoteExcerpt("")); } } diff --git a/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NotesClientUtilTest.java b/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NotesClientUtilTest.java index f8f17bb6..3fec8782 100644 --- a/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NotesClientUtilTest.java +++ b/app/src/androidTest/java/it/niedermann/owncloud/notes/util/NotesClientUtilTest.java @@ -15,8 +15,8 @@ public class NotesClientUtilTest extends TestCase { } public void testIsValidURLTest() { - assertTrue(NotesClientUtil.isValidURL("http://www.example.com/")); - assertTrue(NotesClientUtil.isValidURL("https://www.example.com")); + assertTrue(NotesClientUtil.isValidURL("https://demo.owncloud.org/")); + assertFalse(NotesClientUtil.isValidURL("https://www.example.com/")); assertFalse(NotesClientUtil.isValidURL("htp://www.example.com/")); assertFalse(NotesClientUtil.isValidURL(null)); }