KrakenBaseService extends BaseExchangeService implements BaseService { protected String delimitSet(Set<IOrderFlags> items) { String delimitedSetString = null; if (items != null && !items.isEmpty()) { StringBuilder delimitStringBuilder = null; for (Object item : items) { if (item instanceof KrakenOrderFlags) { if (delimitStringBuilder == null) { delimitStringBuilder = new StringBuilder(item.toString()); } else { delimitStringBuilder.append(",").append(item.toString()); } } } if (delimitStringBuilder != null) { delimitedSetString = delimitStringBuilder.toString(); } } return delimitedSetString; } KrakenBaseService(Exchange exchange); KrakenServerTime getServerTime(); KrakenAssets getKrakenAssets(Currency... assets); R checkResult(KrakenResult<R> krakenResult);  }
@Test public void testDelimitSetOrderFlags() { ExchangeSpecification specification = new ExchangeSpecification(KrakenExchange.class); specification.setShouldLoadRemoteMetaData(false); Exchange exchange = ExchangeFactory.INSTANCE.createExchange(specification); KrakenBaseService service = new KrakenBaseService(exchange); assertThat(service.delimitSet(null)).isNull(); Set<IOrderFlags> flags = new HashSet<>(); assertThat(service.delimitSet(flags)).isNull(); flags.add(KrakenOrderFlags.NOMPP); assertThat(service.delimitSet(flags)).isEqualTo(KrakenOrderFlags.NOMPP.toString()); flags.add(OtherExchangeFlags.OTHER); assertThat(service.delimitSet(flags)).isEqualTo(KrakenOrderFlags.NOMPP.toString()); flags.remove(OtherExchangeFlags.OTHER); flags.add(KrakenOrderFlags.VIQC); flags.add(KrakenOrderFlags.FCIQ); Collection<String> flagsAsStrings = Arrays.asList(service.delimitSet(flags).split(",")); assertThat(flagsAsStrings.size()).isEqualTo(3); assertThat(flagsAsStrings.size()).isEqualTo(flags.size()); for (IOrderFlags flag : flags) { assertThat(flagsAsStrings).contains(flag.toString()); } }