"\"cookie\":\"cookie\"" +
"}";
try {
JSONObject json = new JSONObject(jsonStr);
CNSThrottlePolicy tp = new CNSThrottlePolicy();
assertTrue(tp.getMaxReceivesPerSecond() == null);
//TODO test;
tp.update(json);
assertTrue(tp.getMaxReceivesPerSecond() == 5);
json = new JSONObject(jsonStr2);
tp.update(json);
assertTrue(tp.getMaxReceivesPerSecond() == null);
json = new JSONObject(jsonStr3);
tp.update(json);
assertTrue(tp.getMaxReceivesPerSecond() == null);
json = new JSONObject(jsonStr4);
boolean exceptionOccured = false;
try {
tp.update(json);
} catch (Exception e) {
if(e instanceof CNSModelConstructionException) {
assertTrue(true);
exceptionOccured = true;
logger.debug(((CNSModelConstructionException) e).getErrormessage());
} else {
assertFalse(true);
}
}
assertTrue(exceptionOccured);
exceptionOccured = false;
json = new JSONObject(jsonStr5);
try {
tp.update(json);
} catch (Exception e) {
if(e instanceof CNSModelConstructionException) {
assertTrue(true);
exceptionOccured = true;
logger.debug(((CNSModelConstructionException) e).getErrormessage());