fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fluo-examples] keith-turner commented on a change in pull request #8: Initial PageLoader Test ClassInitial test for the PageLoader class that covers null and empty checks
Date Fri, 15 Mar 2019 14:54:07 GMT
keith-turner commented on a change in pull request #8: Initial PageLoader Test ClassInitial
test for the PageLoader class that covers null and empty checks
URL: https://github.com/apache/fluo-examples/pull/8#discussion_r266015700
 
 

 ##########
 File path: webindex/modules/data/src/test/java/webindex/data/fluo/PageLoaderTest.java
 ##########
 @@ -0,0 +1,63 @@
+package webindex.data.fluo;
+
+import java.net.MalformedURLException;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+import webindex.core.models.Page;
+import webindex.core.models.URL;
+
+@SuppressWarnings("unused")
+public class PageLoaderTest {
+
+	@Test
+	public void testUpdatePageWithNullPage() {
+		Page p = null;
+		PageLoader loader = PageLoader.updatePage(p);
+		loader = null;
+	}
+	
+	@Test(expected = IllegalArgumentException.class)
+	public void testEmptyPageThrowsIllegalArgument() {
+		Page p = Page.EMPTY;
+		PageLoader loader = PageLoader.updatePage(p);
+		loader = null;
+	}
+	
+	@Test(expected = NullPointerException.class)
+	public void testDeleteFailsWithNullUrl() {
+		try {
+			PageLoader loader = PageLoader.deletePage(null);
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	@Test
+	public void testDeletePage() {
+		URL url = new URL("","","",0,false,false);
+		try {
+			PageLoader loader = PageLoader.deletePage(url);
+		} catch (MalformedURLException e) {
+			e.printStackTrace();
+		}
+	}
+	
+	@Test
 
 Review comment:
   Should this be `@Test(expected = NullPointerException.class)`?  Also if that change is
made seem like all of the catch blocks could be dropped.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message