@Test public void get() throws Exception { when(resource.get()).thenReturn(configMap1); try (ConfigMapSupplier underTest = new ConfigMapSupplier(client, name)) { assertThat(underTest.get(), is(configMap1)); } verify(watch).close(); }
@Override public ConfigMap get() { synchronized (lock) { if (configMap == null) { throw new IllegalStateException(String.format("ConfigMap %s has been deleted!", name)); } return configMap; } }
ConfigMapSupplier implements Supplier<ConfigMap>, Watcher<ConfigMap>, AutoCloseable { @Override public ConfigMap get() { synchronized (lock) { if (configMap == null) { throw new IllegalStateException(String.format("ConfigMap %s has been deleted!", name)); } return configMap; } } }
ConfigMapSupplier implements Supplier<ConfigMap>, Watcher<ConfigMap>, AutoCloseable { @Override public ConfigMap get() { synchronized (lock) { if (configMap == null) { throw new IllegalStateException(String.format("ConfigMap %s has been deleted!", name)); } return configMap; } } @Autowired  ConfigMapSupplier(KubernetesClient client, @Value(TruckParkConstants.TRUCK_PARK) String name); }
ConfigMapSupplier implements Supplier<ConfigMap>, Watcher<ConfigMap>, AutoCloseable { @Override public ConfigMap get() { synchronized (lock) { if (configMap == null) { throw new IllegalStateException(String.format("ConfigMap %s has been deleted!", name)); } return configMap; } } @Autowired  ConfigMapSupplier(KubernetesClient client, @Value(TruckParkConstants.TRUCK_PARK) String name); @Override ConfigMap get(); @Override void eventReceived(Action action, ConfigMap configMap); @Override void onClose(KubernetesClientException cause); @Override void close(); }
ConfigMapSupplier implements Supplier<ConfigMap>, Watcher<ConfigMap>, AutoCloseable { @Override public ConfigMap get() { synchronized (lock) { if (configMap == null) { throw new IllegalStateException(String.format("ConfigMap %s has been deleted!", name)); } return configMap; } } @Autowired  ConfigMapSupplier(KubernetesClient client, @Value(TruckParkConstants.TRUCK_PARK) String name); @Override ConfigMap get(); @Override void eventReceived(Action action, ConfigMap configMap); @Override void onClose(KubernetesClientException cause); @Override void close();  }