GatewayReceiverRealizer implements ConfigurationRealizer<GatewayReceiver, GatewayReceiverInfo> { @Override public GatewayReceiverInfo get(GatewayReceiver config, InternalCache cache) { if (cache.getGatewayReceivers() == null || cache.getGatewayReceivers().size() == 0) { return null; } org.apache.geode.cache.wan.GatewayReceiver receiver = cache.getGatewayReceivers().iterator().next(); return generateGatewayReceiverInfo(receiver); }  @Override RealizationResult create(GatewayReceiver config, InternalCache cache); RealizationResult create(GatewayReceiverConfig config, InternalCache cache); @Override boolean exists(GatewayReceiver config, InternalCache cache); @Override GatewayReceiverInfo get(GatewayReceiver config, InternalCache cache); @Override RealizationResult update(GatewayReceiver config, InternalCache cache); @Override RealizationResult delete(GatewayReceiver config, InternalCache cache);  }
@Test public void getGatewayReceiverInfoReturnsNullWhenListIsNull() { InternalCache cache = mock(InternalCache.class); when(cache.getGatewayReceivers()).thenReturn(null); assertThat(gatewayReceiverRealizer.get(null, cache)).isNull(); }
@Test public void getGatewayReceiverInfoReturnsNullWhenListIsEmpty() { InternalCache cache = mock(InternalCache.class); Set<GatewayReceiver> emptySet = Collections.emptySet(); when(cache.getGatewayReceivers()).thenReturn(emptySet); assertThat(gatewayReceiverRealizer.get(null, cache)).isNull(); }