@Before
    public void setUp() throws Exception {
      persistedEntry = new PersistedEntry();
      persistedEntry.setFeed(FEED_NAME);
      persistedEntry.setEntryId(MARKER_ID);
      persistedEntry.setEntryBody(ENTRY_BODY);

      emptyList = new ArrayList<PersistedEntry>();

      entryList = new ArrayList<PersistedEntry>();
      entryList.add(persistedEntry);

      // Mocks
      abdera = mock(Abdera.class);
      getFeedRequest = mock(GetFeedRequest.class);
      getEntryRequest = mock(GetEntryRequest.class);
      jdbcTemplate = mock(JdbcTemplate.class);

      postgresFeedSource = new JdbcFeedSource();
      postgresFeedSource.setJdbcTemplate(jdbcTemplate);

      // Mock GetEntryRequest
      when(getEntryRequest.getFeedName()).thenReturn(FEED_NAME);
      when(getEntryRequest.getEntryId()).thenReturn(MARKER_ID);

      // Mock GetFeedRequest
      when(getFeedRequest.getFeedName()).thenReturn(FEED_NAME);
      when(getFeedRequest.getPageSize()).thenReturn("25");
      when(getFeedRequest.getAbdera()).thenReturn(abdera);
    }
 @Test
 @Ignore
 public void shouldReturnBadRequest() throws Exception {
   assertEquals(
       "Should return HTTP 400 (Bad Request)",
       HttpStatus.BAD_REQUEST,
       postgresFeedSource.getFeed(getFeedRequest).getResponseStatus());
 }
 @Test
 public void shouldReturnBadRequestWhenMarkerUsed() throws Exception {
   when(getFeedRequest.getPageMarker()).thenReturn(MARKER_ID);
   when(getFeedRequest.getDirection()).thenReturn("");
   assertEquals(
       "Should return HTTP 400 (Bad Request)",
       HttpStatus.BAD_REQUEST,
       postgresFeedSource.getFeed(getFeedRequest).getResponseStatus());
 }
 @Test
 public void shouldGetEntry() throws Exception {
   Abdera localAbdera = new Abdera();
   when(jdbcTemplate.query(any(String.class), any(Object[].class), any(EntryRowMapper.class)))
       .thenReturn(entryList);
   when(getEntryRequest.getAbdera()).thenReturn(localAbdera);
   assertEquals(
       "Should get a 200 response",
       HttpStatus.OK,
       postgresFeedSource.getEntry(getEntryRequest).getResponseStatus());
 }
 @Test
 public void shouldNotGetFeedWithMarkerDirectionForward() throws Exception {
   Abdera localAbdera = new Abdera();
   when(getFeedRequest.getAbdera()).thenReturn(localAbdera);
   when(getFeedRequest.getPageMarker()).thenReturn(MARKER_ID);
   when(getFeedRequest.getDirection()).thenReturn("FORWARD");
   when(jdbcTemplate.queryForObject(
           any(String.class), any(EntryRowMapper.class), any(String.class), any(String.class)))
       .thenReturn(null);
   assertEquals(
       "Should get a 404 response",
       HttpStatus.NOT_FOUND,
       postgresFeedSource.getFeed(getFeedRequest).getResponseStatus());
 }
 @Test
 public void shouldGetFeedWithMarkerBackward() throws Exception {
   when(getFeedRequest.getPageMarker()).thenReturn(MARKER_ID);
   when(getFeedRequest.getDirection()).thenReturn(BACKWARD);
   Abdera localAbdera = new Abdera();
   when(jdbcTemplate.queryForObject(
           any(String.class), any(EntryRowMapper.class), any(String.class), any(String.class)))
       .thenReturn(persistedEntry);
   when(getFeedRequest.getAbdera()).thenReturn(localAbdera);
   when(getEntryRequest.getAbdera()).thenReturn(localAbdera);
   when(jdbcTemplate.query(any(String.class), any(Object[].class), any(EntryRowMapper.class)))
       .thenReturn(entryList);
   assertEquals(
       "Should get a 200 response",
       HttpStatus.OK,
       postgresFeedSource.getFeed(getFeedRequest).getResponseStatus());
 }
 @Test
 public void shouldGetFeedHeadWithCategory() throws Exception {
   Abdera localAbdera = new Abdera();
   when(getFeedRequest.getSearchQuery()).thenReturn(SINGLE_CAT);
   when(jdbcTemplate.queryForObject(
           any(String.class), any(EntryRowMapper.class), any(String.class), any(String.class)))
       .thenReturn(persistedEntry);
   when(getFeedRequest.getAbdera()).thenReturn(localAbdera);
   when(getEntryRequest.getAbdera()).thenReturn(localAbdera);
   when(jdbcTemplate.query(any(String.class), any(Object[].class), any(EntryRowMapper.class)))
       .thenReturn(entryList);
   when(jdbcTemplate.queryForInt(any(String.class), any(Object[].class))).thenReturn(1);
   assertEquals(
       "Should get a 200 response",
       HttpStatus.OK,
       postgresFeedSource.getFeed(getFeedRequest).getResponseStatus());
 }
 @Test
 public void shouldSetJdbcTemplate() throws Exception {
   JdbcFeedSource tempPostgresFeedSource = mock(JdbcFeedSource.class);
   tempPostgresFeedSource.setJdbcTemplate(jdbcTemplate);
   verify(tempPostgresFeedSource).setJdbcTemplate(jdbcTemplate);
 }
 @Test(expected = UnsupportedOperationException.class)
 public void shouldSetParameters() throws Exception {
   Map<String, String> map = new HashMap<String, String>();
   map.put("test1", "test2");
   postgresFeedSource.setParameters(map);
 }
 @Test(expected = UnsupportedOperationException.class)
 public void shouldGetFeedInformation() throws Exception {
   postgresFeedSource.getFeedInformation();
 }