StackTraceExpander { @VisibleForTesting @Nullable static String getStackLine(@NotNull String line) { Matcher matcher = EXCEPTION_LINE_PATTERN.matcher(line); return matcher.matches() ? matcher.group(1) : null; } StackTraceExpander(@NotNull String stackTraceLinePrefix, @NotNull String stackTraceCauseLinePrefix); void reset(); static boolean wasLineExpanded(@NotNull String line); @NotNull List<String> process(@NotNull String line);  }
@Test public void testStackFrameMatcher() { String[] validFrames = new String[] { "at com.example.t1.MainActivity.one(MainActivity.java:31)", " at android.app.ActivityThread.access$700(ActivityThread.java:134)", "\tat java.lang.reflect.Method.invokeNative(Native Method)", }; for (String frame: validFrames) { assertThat(StackTraceExpander.getStackLine(frame)).isEqualTo(frame.trim()); } String[] invalidFrames = new String[] { "Caused by: java.lang.RuntimeException", "... 15 more" }; for (String frame: invalidFrames) { Assert.assertNull(StackTraceExpander.getStackLine(frame)); } }