}
private Collection<FinancialSecurity> createRandomCapFloorCMSSpreads(final Random random, final int n) {
final Collection<FinancialSecurity> securities = new HashSet<>();
for (int i = 0; i < n; i++) {
FinancialSecurity security = null;
try {
final Tenor tenor = TENORS[random.nextInt(TENORS.length)];
final Tenor payTenor = PAY_TENORS[random.nextInt(PAY_TENORS.length)];
final Tenor receiveTenor = RECEIVE_TENORS[random.nextInt(RECEIVE_TENORS.length)];
security = makeCMSCapFloorSpread(random, payTenor, receiveTenor, tenor, i);
} catch (final Exception e) {
e.printStackTrace();
}
if (security != null) {
securities.add(security);
}
}
final StringBuilder sb = new StringBuilder();
sb.append("Parsed ").append(securities.size()).append(" CMS cap/floor spreads:\n");
for (final FinancialSecurity security : securities) {
sb.append("\t").append(security.getName()).append("\n");
}
s_logger.info(sb.toString());
return securities;
}