File tree Expand file tree Collapse file tree
approvaltests-tests/src/test/java/org/approvaltests/scrubbers
approvaltests/src/main/java/org/approvaltests/scrubbers Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package org .approvaltests .scrubbers ;
22
3+ import com .spun .util .DateUtils ;
34import com .spun .util .markdown .table .MarkdownColumn ;
45import com .spun .util .markdown .table .MarkdownTable ;
56import org .approvaltests .Approvals ;
67import org .approvaltests .core .Options ;
78import org .junit .jupiter .api .Disabled ;
89import org .junit .jupiter .api .Test ;
910
11+ import java .util .Date ;
1012import java .util .List ;
1113import java .util .stream .Collectors ;
1214import java .util .stream .Stream ;
@@ -76,4 +78,11 @@ void testBlank()
7678 {
7779 DateScrubber .getScrubberFor ("" );
7880 }
81+ @ Test
82+ void testTimestamp ()
83+ {
84+ String input = DateUtils .asTimestamp (new Date ()).toString ();
85+ String scrubbed = DateScrubber .getScrubberForTimestamp ().scrub (input );
86+ assertEquals ("[Date1]" , scrubbed );
87+ }
7988}
Original file line number Diff line number Diff line change 33import com .spun .util .ArrayUtils ;
44import com .spun .util .FormattedException ;
55import com .spun .util .StringUtils ;
6+ import org .approvaltests .core .Scrubber ;
67import org .lambda .functions .Function1 ;
78import org .lambda .query .Query ;
89
10+ import java .sql .Timestamp ;
11+
912public class DateScrubber extends RegExScrubber
1013{
1114 public DateScrubber (String pattern )
@@ -80,6 +83,10 @@ public String scrub(String input)
8083 }
8184 };
8285 }
86+ public static Scrubber getScrubberForTimestamp ()
87+ {
88+ return DateScrubber .getScrubberFor (new Timestamp (0 ).toString ());
89+ }
8390 public static class SupportedFormat
8491 {
8592 private final String [] examples ;
You can’t perform that action at this time.
0 commit comments