### Question:
AggregationDuty implements Duty { public void addValidator( final Validator validator, final int validatorIndex, final BLSSignature proof, final int attestationCommitteeIndex, final SafeFuture<Optional<Attestation>> unsignedAttestationFuture) { aggregatorsByCommitteeIndex.computeIfAbsent( attestationCommitteeIndex, committeeIndex -> { validatorApiChannel.subscribeToBeaconCommitteeForAggregation(committeeIndex, slot); return new CommitteeAggregator( validator, UInt64.valueOf(validatorIndex), attestationCommitteeIndex, proof, unsignedAttestationFuture); }); } AggregationDuty(
      final UInt64 slot,
      final ValidatorApiChannel validatorApiChannel,
      final ForkProvider forkProvider,
      final ValidatorLogger validatorLogger); void addValidator(
      final Validator validator,
      final int validatorIndex,
      final BLSSignature proof,
      final int attestationCommitteeIndex,
      final SafeFuture<Optional<Attestation>> unsignedAttestationFuture); @Override SafeFuture<DutyResult> performDuty(); SafeFuture<DutyResult> aggregateCommittee(final CommitteeAggregator aggregator); CompletionStage<Optional<Attestation>> createAggregate(
      final Optional<Attestation> maybeAttestation); @Override String getProducedType();  }### Answer:
@Test public void shouldSubscribeToCommitteeTopicWhenNewCommitteeAdded() { final int committeeIndex = 2; duty.addValidator( validator1, 1, dataStructureUtil.randomSignature(), committeeIndex, new SafeFuture<>()); verify(validatorApiChannel).subscribeToBeaconCommitteeForAggregation(committeeIndex, SLOT); }
@Test public void shouldNotSubscribeToCommitteeTopicWhenAdditionalValidatorAdded() { final int committeeIndex = 2; duty.addValidator( validator1, 1, dataStructureUtil.randomSignature(), committeeIndex, new SafeFuture<>()); duty.addValidator( validator2, 2, dataStructureUtil.randomSignature(), committeeIndex, new SafeFuture<>()); verify(validatorApiChannel, times(1)) .subscribeToBeaconCommitteeForAggregation(committeeIndex, SLOT); }