Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
LogTest.java
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5package io.flutter;
6
7import static org.junit.Assert.assertEquals;
8
9import java.io.PrintWriter;
10import java.io.StringWriter;
11import org.junit.Test;
12import org.junit.runner.RunWith;
13import org.robolectric.RobolectricTestRunner;
14import org.robolectric.annotation.Config;
15
16@Config(manifest = Config.NONE)
17@RunWith(RobolectricTestRunner.class)
18public class LogTest {
19
20 @Test
21 public void canGetStacktraceString() {
22 Exception exception = new Exception();
23 String str = Log.getStackTraceString(exception);
24
25 StringWriter stringWriter = new StringWriter();
26 PrintWriter printWriter = new PrintWriter(stringWriter);
27 exception.printStackTrace(printWriter);
28 String expectStr = stringWriter.toString();
29
30 assertEquals(str, expectStr);
31 }
32}
void canGetStacktraceString()
Definition LogTest.java:21
static String getStackTraceString(@Nullable Throwable tr)
Definition Log.java:101