test_class.declarator: governanceRepository
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private GovernanceRepository governanceRepository;
test_class.type: GovernanceRepository
test_class.var_name: governanceRepository
test_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/test/java/org/apache/shardingsphere/governance/core/event/listener/PostGovernanceRepositoryEventListenerTest.java
test_class.identifier: PostGovernanceRepositoryEventListenerTest
test_case.body: @Test
      public void assertWatch() {
          PostGovernanceRepositoryEventListener postEventListener = new PostGovernanceRepositoryEventListener(governanceRepository, Collections.singletonList("test")) {
              
              @Override
              protected Optional<GovernanceEvent> createGovernanceEvent(final DataChangedEvent event) {
                  return Optional.of(mock(GovernanceEvent.class));
              }
          };
          doAnswer(invocationOnMock -> {
              DataChangedEventListener listener = (DataChangedEventListener) invocationOnMock.getArguments()[1];
              listener.onChange(new DataChangedEvent("test", "value", ChangedType.UPDATED));
              return mock(DataChangedEventListener.class);
          }).when(governanceRepository).watch(anyString(), any(DataChangedEventListener.class));
          postEventListener.watch(ChangedType.UPDATED);
          verify(governanceRepository).watch(eq("test"), any());
      }
test_case.class_method_signature: PostGovernanceRepositoryEventListenerTest.assertWatch()
test_case.full_signature: @Test public void assertWatch()
test_case.identifier: assertWatch
test_case.invocations: singletonList of mock watch when doAnswer getArguments onChange mock anyString any watch watch verify eq any
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void assertWatch()
focal_class.declarator: governanceRepository
focal_class.modifier: private final
focal_class.original_string: private final GovernanceRepository governanceRepository;
focal_class.type: GovernanceRepository
focal_class.var_name: governanceRepository
focal_class.declarator: watchKeys
focal_class.modifier: private final
focal_class.original_string: private final Collection<String> watchKeys;
focal_class.type: Collection<String>
focal_class.var_name: watchKeys
focal_class.file: shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/event/listener/PostGovernanceRepositoryEventListener.java
focal_class.identifier: PostGovernanceRepositoryEventListener
focal_class.interfaces: implements GovernanceListener
focal_class.class_method_signature: PostGovernanceRepositoryEventListener.watch(final ChangedType... changedTypes)
focal_class.full_signature: @Override public final void watch(final ChangedType... changedTypes)
focal_class.identifier: watch
focal_class.modifiers: @Override public final
focal_class.parameters: (final ChangedType... changedTypes)
focal_class.return: void
focal_class.signature: void watch(final ChangedType... changedTypes)
focal_class.class_method_signature: PostGovernanceRepositoryEventListener.watch(final String watchKey, final Collection<ChangedType> changedTypes)
focal_class.full_signature: private void watch(final String watchKey, final Collection<ChangedType> changedTypes)
focal_class.identifier: watch
focal_class.modifiers: private
focal_class.parameters: (final String watchKey, final Collection<ChangedType> changedTypes)
focal_class.return: void
focal_class.signature: void watch(final String watchKey, final Collection<ChangedType> changedTypes)
focal_class.class_method_signature: PostGovernanceRepositoryEventListener.createGovernanceEvent(DataChangedEvent event)
focal_class.full_signature: protected abstract Optional<GovernanceEvent> createGovernanceEvent(DataChangedEvent event)
focal_class.identifier: createGovernanceEvent
focal_class.modifiers: protected abstract
focal_class.parameters: (DataChangedEvent event)
focal_class.return: Optional<GovernanceEvent>
focal_class.signature: Optional<GovernanceEvent> createGovernanceEvent(DataChangedEvent event)
focal_method.body: @Override
      public final void watch(final ChangedType... changedTypes) {
          Collection<ChangedType> watchedChangedTypeList = Arrays.asList(changedTypes);
          for (String watchKey : watchKeys) {
              watch(watchKey, watchedChangedTypeList);
          }
      }
focal_method.class_method_signature: PostGovernanceRepositoryEventListener.watch(final ChangedType... changedTypes)
focal_method.full_signature: @Override public final void watch(final ChangedType... changedTypes)
focal_method.identifier: watch
focal_method.invocations: asList watch
focal_method.modifiers: @Override public final
focal_method.parameters: (final ChangedType... changedTypes)
focal_method.return: void
focal_method.signature: void watch(final ChangedType... changedTypes)