@@ -92,17 +92,18 @@ public void tearDown() throws Exception {
9292
9393 @ Test
9494 public void testLoggingActorRefs () {
95- final ActorRef actorRef = _actorSystem .actorOf (Props .create (SimpleActor .class , SimpleActor ::new ));
95+ final ActorRef actorRef = _actorSystem .actorOf (Props .create (SimpleActor .class , SimpleActor ::new ), "simple-actor" );
9696 getLogger ().info ()
9797 .setMessage ("LoggingActorRefs" )
9898 .addData ("actorRef" , actorRef )
9999 .log ();
100+ assertOutput ();
100101 }
101102
102103 protected void assertOutput () {
103104 final URL expectedResource = getClass ().getResource (
104105 getClass ().getSimpleName () + ".expected" );
105- final File actualFile = new File ("target/integration- test-logs/" + this .getClass ().getSimpleName () + ".log" );
106+ final File actualFile = new File ("target/test-logs/" + this .getClass ().getSimpleName () + ".log" );
106107 final String actualOutput ;
107108 try {
108109 actualOutput = Files .readString (actualFile .toPath ());
@@ -117,7 +118,18 @@ protected void assertOutput() {
117118 }
118119
119120 protected void assertOutput (final String expected , final String actual ) {
120- Assert .assertEquals (expected , actual );
121+ Assert .assertEquals (expected .trim (), sanitizeOutput (actual .trim ()));
122+ }
123+
124+ protected String sanitizeOutput (final String output ) {
125+ return output .replaceAll ("\" time\" :\" [^\" ]+\" " , "\" time\" :\" <TIME>\" " )
126+ .replaceAll ("\" id\" :\" [^\" ]+\" " , "\" id\" :\" <ID>\" " )
127+ .replaceAll ("Actor\\ [pekko://default/user/simple-actor[^\" ]+]\" " , "Actor[pekko://default/user/simple-actor]\" " )
128+ .replaceAll ("\" host\" :\" [^\" ]+\" " , "\" host\" :\" <HOST>\" " )
129+ .replaceAll ("\" processId\" :\" [^\" ]+\" " , "\" processId\" :\" <PROCESS_ID>\" " )
130+ .replaceAll ("\" threadId\" :\" [^\" ]+\" " , "\" threadId\" :\" <THREAD_ID>\" " )
131+ .replaceAll ("\" backtrace\" :\\ [[^\\ ]]+\\ ]" , "\" backtrace\" :[]" )
132+ .replaceAll ("\" _id\" :\" [^\" ]+\" " , "\" _id\" :\" <ID>\" " );
121133 }
122134
123135 protected Logger getLogger () {
0 commit comments