Fix Unit Tests

This commit is contained in:
Stefan Niedermann 2015-10-23 11:48:15 +02:00
parent 9a1ed65f24
commit ba5b309d8f
2 changed files with 8 additions and 4 deletions

View file

@ -25,9 +25,10 @@ public class NoteUtilTest extends TestCase {
assertEquals("Test", NoteUtil.getLineWithoutMarkDown("Test", 0)); assertEquals("Test", NoteUtil.getLineWithoutMarkDown("Test", 0));
assertEquals("Test", NoteUtil.getLineWithoutMarkDown("\nTest", 0)); assertEquals("Test", NoteUtil.getLineWithoutMarkDown("\nTest", 0));
assertEquals("Foo", NoteUtil.getLineWithoutMarkDown("Foo\nBar", 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"));
assertEquals("Test", NoteUtil.generateNoteTitle("Test\n")); assertEquals("Test", NoteUtil.generateNoteTitle("Test\n"));
assertEquals("Test", NoteUtil.generateNoteTitle("Test\nFoo")); assertEquals("Test", NoteUtil.generateNoteTitle("Test\nFoo"));
@ -35,7 +36,10 @@ public class NoteUtilTest extends TestCase {
assertEquals("Test", NoteUtil.generateNoteTitle("\n\nTest")); assertEquals("Test", NoteUtil.generateNoteTitle("\n\nTest"));
} }
public void testGenerateExcerpt() { public void testGenerateNoteExcerpt() {
assertEquals("Test", NoteUtil.generateNoteExcerpt("Test")); assertEquals("Test", NoteUtil.generateNoteExcerpt("Test"));
assertEquals("Foo", NoteUtil.generateNoteExcerpt("Test\nFoo"));
assertEquals("Foo", NoteUtil.generateNoteExcerpt("Test\nFoo\nBar"));
assertEquals("", NoteUtil.generateNoteExcerpt(""));
} }
} }

View file

@ -15,8 +15,8 @@ public class NotesClientUtilTest extends TestCase {
} }
public void testIsValidURLTest() { public void testIsValidURLTest() {
assertTrue(NotesClientUtil.isValidURL("http://www.example.com/")); assertTrue(NotesClientUtil.isValidURL("https://demo.owncloud.org/"));
assertTrue(NotesClientUtil.isValidURL("https://www.example.com")); assertFalse(NotesClientUtil.isValidURL("https://www.example.com/"));
assertFalse(NotesClientUtil.isValidURL("htp://www.example.com/")); assertFalse(NotesClientUtil.isValidURL("htp://www.example.com/"));
assertFalse(NotesClientUtil.isValidURL(null)); assertFalse(NotesClientUtil.isValidURL(null));
} }