* @throws Exception
*/
@Test
@SuppressWarnings("nls")
public void testConditionalGet() throws Exception {
ConnectionManager conManager = ConnectionManager.getDefault();
URL feedUrl = new URL("http://rss.slashdot.org/Slashdot/slashdot/to");
IFeed feed = new Feed(feedUrl);
NotModifiedException e = null;
InputStream inS = conManager.load(feed.getLink());
assertNotNull(inS);
String ifModifiedSince = null;
String ifNoneMatch = null;
if (inS instanceof IConditionalGetCompatible) {
ifModifiedSince = ((IConditionalGetCompatible) inS).getIfModifiedSince();
ifNoneMatch = ((IConditionalGetCompatible) inS).getIfNoneMatch();
}
IConditionalGet conditionalGet = NewsModel.getDefault().getTypesFactory().createConditionalGet(ifModifiedSince, feedUrl, ifNoneMatch);
Map<Object, Object> conProperties = new HashMap<Object, Object>();
ifModifiedSince = conditionalGet.getIfModifiedSince();
if (ifModifiedSince != null)
conProperties.put(IConnectionPropertyConstants.IF_MODIFIED_SINCE, ifModifiedSince);
ifNoneMatch = conditionalGet.getIfNoneMatch();
if (ifNoneMatch != null)
conProperties.put(IConnectionPropertyConstants.IF_NONE_MATCH, ifNoneMatch);
try {
conManager.load(feed.getLink(), conProperties);
} catch (NotModifiedException e1) {
e = e1;
}
assertNotNull(e);