コード例 #1
0
 private void connectWithValues(Map<String, String> testValue) {
   IConfigMap testMap = mock(IConfigMap.class);
   when(testMap.getName()).thenReturn("foo");
   when(testMap.getResourceVersion()).thenReturn("1234");
   when(testMap.getData()).thenReturn(testValue);
   database.connected(Collections.singletonList(testMap));
 }
コード例 #2
0
  @Test
  public void testUpdates() {
    Map<String, String> testValue = Collections.singletonMap("bar", "baz");
    connectWithValues(testValue);

    ConfigSubscriber sub = mock(ConfigSubscriber.class);
    database.subscribe("foo", sub);

    verify(sub).configUpdated("foo", "1234", testValue);

    testValue = Collections.singletonMap("quux", "bim");
    IConfigMap newMap = mock(IConfigMap.class);
    when(newMap.getName()).thenReturn("foo");
    when(newMap.getResourceVersion()).thenReturn("1235");
    when(newMap.getData()).thenReturn(testValue);
    database.received(newMap, IOpenShiftWatchListener.ChangeType.MODIFIED);

    verify(sub).configUpdated("foo", "1235", testValue);
  }