StackFrameParser { public int getLineNumber() { int start = getLastColon(); int end = getCloseParen(); if (start >= end || start == -1) { return INVALID_LINE_NUMBER; } try { return Integer.parseInt(myLine.substring(start + 1, end)); } catch (Exception e) { return INVALID_LINE_NUMBER; } } StackFrameParser(@NotNull String line); @Nullable String getClassName(); @Nullable String getFileName(); @Nullable String getMethodName(); int getLineNumber(); int getLastColon(); int getLastDot(); int getOpenParen(); int getCloseParen(); @NotNull CodeLocation toCodeLocation();  }
@Test public void getLineNumber() { String line = "com.example.android.displayingbitmaps.util.ImageFetcher.downloadUrlToStream(ImageFetcher.java:274)"; assertEquals(274, new StackFrameParser(line).getLineNumber()); }
@Test public void getNoLineNumber() { String line = "com.example.android.displayingbitmaps.util.ImageFetcher.downloadUrlToStream(ImageFetcher.java)"; assertEquals(INVALID_LINE_NUMBER, new StackFrameParser(line).getLineNumber()); }
@Test public void getInvalidLineNumber() { String line = "com.example.android.displayingbitmaps.util.ImageFetcher.downloadUrlToStream(ImageFetcher.java:init)"; assertEquals(INVALID_LINE_NUMBER, new StackFrameParser(line).getLineNumber()); }