21
21
import static java .util .Arrays .stream ;
22
22
import static org .junit .Assert .assertThrows ;
23
23
import static org .mockito .ArgumentMatchers .any ;
24
+ import static org .mockito .ArgumentMatchers .anyLong ;
24
25
import static org .mockito .ArgumentMatchers .eq ;
25
26
import static org .mockito .Mockito .doAnswer ;
26
27
import static org .mockito .Mockito .doReturn ;
@@ -578,9 +579,9 @@ public void getDigest_fromInputArtifactData_forLocalArtifact() throws Exception
578
579
// Verify that we don't fall back to a slow digest.
579
580
reset (fs );
580
581
assertThat (actionFs .getFastDigest (path )).isEqualTo (getDigest ("local contents" ));
581
- verify (fs , never ()).getDigest (any ());
582
+ verify (fs , never ()).getDigest (any (), anyLong () );
582
583
583
- assertThat (actionFs .getDigest (path )).isEqualTo (getDigest ("local contents" ));
584
+ assertThat (actionFs .getDigest (path , - 1 )).isEqualTo (getDigest ("local contents" ));
584
585
}
585
586
586
587
@ Test
@@ -593,9 +594,9 @@ public void getDigest_fromInputArtifactData_forRemoteArtifact() throws Exception
593
594
// Verify that we don't fall back to a slow digest.
594
595
reset (fs );
595
596
assertThat (actionFs .getFastDigest (path )).isEqualTo (getDigest ("remote contents" ));
596
- verify (fs , never ()).getDigest (any ());
597
+ verify (fs , never ()).getDigest (any (), anyLong () );
597
598
598
- assertThat (actionFs .getDigest (path )).isEqualTo (getDigest ("remote contents" ));
599
+ assertThat (actionFs .getDigest (path , - 1 )).isEqualTo (getDigest ("remote contents" ));
599
600
}
600
601
601
602
@ Test
@@ -606,7 +607,7 @@ public void getDigest_fromRemoteOutputTree() throws Exception {
606
607
injectRemoteFile (actionFs , artifact .getPath ().asFragment (), "remote contents" );
607
608
608
609
assertThat (actionFs .getFastDigest (path )).isEqualTo (getDigest ("remote contents" ));
609
- assertThat (actionFs .getDigest (path )).isEqualTo (getDigest ("remote contents" ));
610
+ assertThat (actionFs .getDigest (path , - 1 )).isEqualTo (getDigest ("remote contents" ));
610
611
}
611
612
612
613
@ Test
@@ -617,7 +618,7 @@ public void getDigest_fromLocalFilesystem() throws Exception {
617
618
writeLocalFile (actionFs , artifact .getPath ().asFragment (), "local contents" );
618
619
619
620
assertThat (actionFs .getFastDigest (path )).isNull ();
620
- assertThat (actionFs .getDigest (path )).isEqualTo (getDigest ("local contents" ));
621
+ assertThat (actionFs .getDigest (path , - 1 )).isEqualTo (getDigest ("local contents" ));
621
622
}
622
623
623
624
@ Test
@@ -627,7 +628,7 @@ public void getDigest_notFound() throws Exception {
627
628
PathFragment path = artifact .getPath ().asFragment ();
628
629
629
630
assertThrows (FileNotFoundException .class , () -> actionFs .getFastDigest (path ));
630
- assertThrows (FileNotFoundException .class , () -> actionFs .getDigest (path ));
631
+ assertThrows (FileNotFoundException .class , () -> actionFs .getDigest (path , - 1 ));
631
632
}
632
633
633
634
@ Test
@@ -650,7 +651,7 @@ public void getDigest_followSymlinks(
650
651
assertThat (actionFs .getFastDigest (linkPath )).isEqualTo (getDigest ("content" ));
651
652
}
652
653
653
- assertThat (actionFs .getDigest (linkPath )).isEqualTo (getDigest ("content" ));
654
+ assertThat (actionFs .getDigest (linkPath , - 1 )).isEqualTo (getDigest ("content" ));
654
655
}
655
656
656
657
@ Test
0 commit comments