### Question:
CTSQueueConfiguration implements QueueConfiguration { @Override public int getProcessors() throws DataLayerException { try { int max = dataLayerConfig.getConfig(ConnectionType.CTS_ASYNC).getMaxConnections(); return findPowerOfTwo(max - 1); } catch (IllegalArgumentException e) { throw new DataLayerException("Number of connections too low", e); } catch (InvalidConfigurationException e) { throw new DataLayerException("Configuration was invalid", e); } } @Inject  CTSQueueConfiguration(ConnectionConfigFactory dataLayerConfig,
            @Named(CoreTokenConstants.CTS_ASYNC_DEBUG) Debug debug); @Override int getQueueTimeout(); @Override int getQueueSize(); @Override int getProcessors(); static int findPowerOfTwo(int value); static final int DEFAULT_TIMEOUT; static final int DEFAULT_QUEUE_SIZE; }### Answer:
@Test public void shouldReturnConnectionsFromConfiguration() throws Exception { int count = 20; given(mockConfig.getMaxConnections()).willReturn(count); int result = config.getProcessors(); assertThat(result).isLessThan(count); }
@Test public void shouldThrowExceptionIfConnectionsTooLow() throws Exception { given(mockConfig.getMaxConnections()).willReturn(1); DataLayerException result = null; try { config.getProcessors(); } catch (DataLayerException e) { result = e; } assertThat(result).isNotNull(); }