RssFeedController { @RequestMapping(value = { "/rssfeed" }, method = RequestMethod.GET) public ModelAndView getLatestExperiments( HttpServletRequest request, HttpServletResponse response ) { WhatsNew wn = whatsNewService.retrieveReport(); if ( wn == null ) { wn = whatsNewService.getReport(); } int updatedExperimentsCount = 0; int newExperimentsCount = 0; Map<ExpressionExperiment, String> experiments = new HashMap<>(); if ( wn != null ) { Collection<ExpressionExperiment> updatedExperiments = wn.getUpdatedExpressionExperiments(); Collection<ExpressionExperiment> newExperiments = wn.getNewExpressionExperiments(); for ( ExpressionExperiment e : updatedExperiments ) { experiments.put( e, "Updated" ); } for ( ExpressionExperiment e : newExperiments ) { experiments.put( e, "New" ); } updatedExperimentsCount = updatedExperiments.size(); newExperimentsCount = newExperiments.size(); } ModelAndView mav = new ModelAndView(); mav.setView( customRssViewer ); mav.addObject( "feedContent", experiments ); mav.addObject( "updateCount", updatedExperimentsCount ); mav.addObject( "newCount", newExperimentsCount ); log.debug( "RSS experiments loaded." ); return mav; }  @RequestMapping(value = { "/rssfeed" }, method = RequestMethod.GET) ModelAndView getLatestExperiments( HttpServletRequest request, HttpServletResponse response );  }
@Test public void testGetLatestExperiments() { ModelAndView mav = rssFeedController.getLatestExperiments( null, null ); assertNotNull( mav ); Map<String, Object> model = mav.getModel(); assertNotNull( model ); @SuppressWarnings("unchecked") Map<ExpressionExperiment, String> retreivedExperiments = ( Map<ExpressionExperiment, String> ) model .get( "feedContent" ); Integer retreivedUpdateCount = ( Integer ) model.get( "updateCount" ); Integer retreivedNewCount = ( Integer ) model.get( "newCount" ); assertNotNull( retreivedExperiments ); assertNotNull( retreivedUpdateCount ); assertNotNull( retreivedNewCount ); assertTrue( RegressionTesting.containsSame( experiments.keySet(), retreivedExperiments.keySet() ) ); assertEquals( updateCount, retreivedUpdateCount.intValue() ); assertEquals( newCount, retreivedNewCount.intValue() ); }