Table of Contents

New Feed Checker

In this homework, we will develop a small software that checks if the feeds that we subscribed have any updates.

Basic components

Our main object, a FeedChecker, uses two other objects: a FeedReader and a FeedDatabase.

The following interfaces describe both classes.

import java.util.List;
 
public interface FeedReader {
	List<String> getTitles();
	void fetch();
}
import java.util.List;
 
public interface FeedDatabase {
	List<String> getTitles();
}

Following is the skeleton of the Class Under Test, FeedChecker.

import java.util.List;
 
public class FeedChecker {
 
	public FeedChecker(FeedReader reader, FeedDatabase db) {}
 
	public void check() {}
 
	public List<String> getNewTitles() {}
}

When method check() is called, a FeedChecker would invoke fetch from the FeedReader, then compares the list of titles returned from FeedReader and the titles returned from FeedDatabase. Method getNewTitle() returns a list of new titles, i.e., those titles returned by FeedReader which are not returned by FeedDatabase.

FeedCheckerTest

Your task is to develop a unit test FeedCheckerTest for FeedChecker. You should include at least 3 interesting test cases (Recall the slides on 'what to test'?). Also, you have to implement FeedChecker so that it passes all test cases.

Don't implement FeedReader or FeedDatabase. You should mock them instead.