Skip to content

Commit

Permalink
ZOOKEEPER-2994. Fix for unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnar committed Mar 26, 2018
1 parent 15fa45c commit 0b95efe
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@
import java.io.IOException;
import java.io.PrintStream;
import java.io.StringReader;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;


public class TxnLogToolkitTest {
Expand Down Expand Up @@ -101,7 +104,9 @@ public void testDumpWithCrcError() throws Exception {

// Assert
String output = outContent.toString();
assertThat(output, containsString("CRC ERROR - 3/6/18 11:06:09 AM CET session 0x8061fac5ddeb0000"));
Pattern p = Pattern.compile("^CRC ERROR.*session 0x8061fac5ddeb0000 cxid 0x0 zxid 0x8800000002 createSession 30000$", Pattern.MULTILINE);
Matcher m = p.matcher(output);
assertTrue("Output doesn't indicate CRC error for the broken session id: " + output, m.find());
}

@Test
Expand Down

0 comments on commit 0b95efe

Please sign in to comment.