コード例 #1
0
 @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());
 }
コード例 #2
0
 @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());
 }
コード例 #3
0
 @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());
 }