anchor.diff:  // ignore_for_file: avoid_redundant_argument_values
   
   void main() {
  +  const tasksCollectionName = 'tasks';
  +  const projectId = 'projectId';
  +  const durationInMilliseconds = 123;
  +  const buildStatus = BuildStatus.successful;
  +
  +  final startedAt = DateTime.now();
  +  final startedAtDayUtc = startedAt.toUtc().date;
  +  final testDataGenerator = BuildTestDataGenerator(
  +    projectId: projectId,
  +  );
  +  final buildJson = testDataGenerator.generateBuildJson();
  +  final buildDocumentData = DocumentData.fromMap(buildJson);
  +
  +  final firestore = FirestoreMock();
  +  final collectionReference = CollectionReferenceMock();
  +  final documentReference = DocumentReferenceMock();
  +  final documentSnapshot = DocumentSnapshotMock();
  +
  +  Matcher documentFieldIncrementMatcher(String fieldName, int expectedCount) {
  +    return predicate<DocumentData>((data) {
  +      final count = data.getNestedData(fieldName).getInt('operand');
  +
  +      return count == expectedCount;
  +    });
  +  }
  +
  +  PostExpectation<Firestore> whenFirestore() {
  +    return when(documentSnapshot.firestore);
  +  }
  +
  +  PostExpectation<DocumentReference> whenDocument() {
  +    whenFirestore().thenReturn(firestore);
  +
  +    return when(firestore.document(any));
  +  }
  +
  +  PostExpectation<Future<DocumentReference>> whenCreateTaskDocument({
  +    Exception exception,
  +  }) {
  +    when(documentReference.setData(any, any))
  +        .thenAnswer((_) => Future.error(exception));
  +
  +    when(firestore.collection(tasksCollectionName))
  +        .thenReturn(collectionReference);
  +
  +    return when(collectionReference.add(any));
  +  }
  +
  +  tearDown(() {
  +    reset(documentSnapshot);
  +    reset(firestore);
  +    reset(collectionReference);
  +    reset(documentReference);
  +  });
  +
     group("onBuildAddedHandler", () {
  -    const tasksCollectionName = 'tasks';
  -    const projectId = 'projectId';
  -    const durationInMilliseconds = 123;
  -    const buildStatus = BuildStatus.successful;
  -
  -    final startedAt = DateTime.now();
  -    final startedAtDayUtc = startedAt.toUtc().date;
  -    final testDataGenerator = BuildTestDataGenerator(
  -      projectId: projectId,
  -    );
  -
  -    final firestoreMock = FirestoreMock();
  -    final collectionReferenceMock = CollectionReferenceMock();
  -    final taskCollectionReferenceMock = CollectionReferenceMock();
  -    final documentReferenceMock = DocumentReferenceMock();
  -    final documentSnapshotMock = DocumentSnapshotMock();
  -
  -    PostExpectation<Firestore> whenFirestore() {
  -      return when(documentSnapshotMock.firestore);
  -    }
  -
  -    PostExpectation<DocumentReference> whenDocument() {
  -      whenFirestore().thenReturn(firestoreMock);
  -
  -      return when(firestoreMock.document(any));
  -    }
  -
  -    PostExpectation<Future<void>> whenSetDocumentData() {
  -      whenDocument().thenReturn(documentReferenceMock);
  -
  -      return when(documentReferenceMock.setData(any, any));
  -    }
  -
  -    PostExpectation<DocumentData> whenDocumentSnapshotData() {
  -      whenDocument().thenReturn(documentReferenceMock);
  -
  -      return when(documentSnapshotMock.data);
  -    }
  -
  -    PostExpectation<Future<DocumentReference>> whenCreateTaskDocument({
  -      Exception exception,
  -    }) {
  -      whenSetDocumentData().thenAnswer((_) => Future.error(exception));
  -
  -      when(firestoreMock.collection(tasksCollectionName))
  -          .thenReturn(taskCollectionReferenceMock);
  -
  -      return when(taskCollectionReferenceMock.add(any));
  -    }
  -
  -    tearDown(() {
  -      reset(documentSnapshotMock);
  -      reset(firestoreMock);
  -      reset(collectionReferenceMock);
  -      reset(taskCollectionReferenceMock);
  -      reset(documentReferenceMock);
  -    });
  -
       test(
         "does not increment the successful builds duration if the build document snapshot's duration is null",
         () async {
  
positive.code:           startedAt: startedAt,
          );
  
          whenDocumentSnapshotData().thenReturn(DocumentData.fromMap(buildJson));
  
          await onBuildAddedHandler(documentSnapshotMock, null);
  
          final documentId =
              '${projectId}_${startedAtDayUtc.millisecondsSinceEpoch}';
  
          verify(firestoreMock.document('build_days/$documentId')).called(1);
        },
      );
  
  
negative.code:       () async {
          final buildDayStatusFieldName =
              BuildDayStatusFieldName.successful.value;
  
          whenDocument().thenReturn(documentReference);
          when(documentSnapshot.data).thenReturn(buildDocumentData);
  
          await onBuildAddedHandler(documentSnapshot, null);
  
          final statusFieldIncrementMatcher =
              documentFieldIncrementMatcher(buildDayStatusFieldName, 1);
  
          verify(
            documentReference.setData(
              argThat(statusFieldIncrementMatcher),
              any,
            ),
          ).called(1);
  