diff --git a/backtrace-library/src/androidTest/java/backtraceio/library/models/BacktraceDataTest.java b/backtrace-library/src/androidTest/java/backtraceio/library/models/BacktraceDataTest.java index 2a5ac57e..4517b315 100644 --- a/backtrace-library/src/androidTest/java/backtraceio/library/models/BacktraceDataTest.java +++ b/backtrace-library/src/androidTest/java/backtraceio/library/models/BacktraceDataTest.java @@ -2,6 +2,7 @@ import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; import android.content.Context; @@ -42,25 +43,25 @@ public void createBacktraceDataTest() { BacktraceData backtraceData = new BacktraceData.Builder(context, report, clientAttributes).build(); // THEN - assertArrayEquals(backtraceData.getClassifiers(), new String[]{"java.lang.IllegalAccessException"}); - assertEquals(backtraceData.getReport(), report); - assertEquals(backtraceData.getAttributes().get("classifier"), "java.lang.IllegalAccessException"); - assertEquals(backtraceData.getAgent(), "backtrace-android"); - assertEquals(backtraceData.getAgentVersion(), backtraceio.library.BuildConfig.VERSION_NAME); - assertEquals(backtraceData.getLang(), "java"); - assertEquals(backtraceData.getLangVersion(), "0"); - assertEquals(backtraceData.getSymbolication(), ""); - assertEquals(backtraceData.getTimestamp(), report.timestamp); - assertEquals(backtraceData.getUuid(), report.uuid.toString()); - assertEquals(backtraceData.getAttributes().size(), 43); - assertEquals(backtraceData.getAnnotations().size(), 3); - assertEquals(backtraceData.getMainThread(), "instr: androidx.test.runner.androidjunitrunner"); - assertEquals(backtraceData.getSourceCode().size(), 34); - assertEquals(backtraceData.getThreadInformationMap().size(), 15); - assertEquals(backtraceData.getAttachmentPaths().size(), 3); - assertEquals(backtraceData.getAttributes().get("attr-1"), "1"); - assertEquals(backtraceData.getAttributes().get("attr-2"), "true"); - assertEquals(backtraceData.getAttributes().get("attr-3"), "test"); + assertArrayEquals( new String[]{"java.lang.IllegalAccessException"} , backtraceData.getClassifiers()); + assertEquals(report, backtraceData.getReport()); + assertEquals("java.lang.IllegalAccessException", backtraceData.getAttributes().get("classifier")); + assertEquals("backtrace-android", backtraceData.getAgent()); + assertEquals(backtraceio.library.BuildConfig.VERSION_NAME, backtraceData.getAgentVersion()); + assertEquals("java", backtraceData.getLang()); + assertEquals("0", backtraceData.getLangVersion()); + assertEquals("", backtraceData.getSymbolication()); + assertEquals(report.timestamp, backtraceData.getTimestamp()); + assertEquals(report.uuid.toString(), backtraceData.getUuid()); + assertEquals(43, backtraceData.getAttributes().size()); + assertEquals(3, backtraceData.getAnnotations().size()); + assertEquals("instr: androidx.test.runner.androidjunitrunner", backtraceData.getMainThread()); + assertEquals(34, backtraceData.getSourceCode().size()); + assertTrue(!backtraceData.getThreadInformationMap().isEmpty()); + assertEquals(3, backtraceData.getAttachmentPaths().size()); + assertEquals("1", backtraceData.getAttributes().get("attr-1")); + assertEquals("true", backtraceData.getAttributes().get("attr-2")); + assertEquals("test", backtraceData.getAttributes().get("attr-3")); } @Test public void testBacktraceDataConstructor() { @@ -77,24 +78,24 @@ public void testBacktraceDataConstructor() { BacktraceData backtraceData = new BacktraceData(context, report, clientAttributes); // THEN - assertArrayEquals(backtraceData.getClassifiers(), new String[]{"java.lang.IllegalAccessException"}); - assertEquals(backtraceData.getReport(), report); - assertEquals(backtraceData.getAttributes().get("classifier"), "java.lang.IllegalAccessException"); - assertEquals(backtraceData.getAgent(), "backtrace-android"); - assertEquals(backtraceData.getAgentVersion(), backtraceio.library.BuildConfig.VERSION_NAME); - assertEquals(backtraceData.getLang(), "java"); - assertEquals(backtraceData.getLangVersion(), "0"); - assertEquals(backtraceData.getSymbolication(), ""); - assertEquals(backtraceData.getTimestamp(), report.timestamp); - assertEquals(backtraceData.getUuid(), report.uuid.toString()); - assertEquals(backtraceData.getAttributes().size(), 43); - assertEquals(backtraceData.getAnnotations().size(), 3); - assertEquals(backtraceData.getMainThread(), "instr: androidx.test.runner.androidjunitrunner"); - assertEquals(backtraceData.getSourceCode().size(), 34); - assertEquals(backtraceData.getThreadInformationMap().size(), 13); - assertEquals(backtraceData.getAttachmentPaths().size(), 3); - assertEquals(backtraceData.getAttributes().get("attr-1"), "1"); - assertEquals(backtraceData.getAttributes().get("attr-2"), "true"); - assertEquals(backtraceData.getAttributes().get("attr-3"), "test"); + assertArrayEquals( new String[]{"java.lang.IllegalAccessException"}, backtraceData.getClassifiers()); + assertEquals(report, backtraceData.getReport()); + assertEquals("java.lang.IllegalAccessException", backtraceData.getAttributes().get("classifier")); + assertEquals("backtrace-android", backtraceData.getAgent()); + assertEquals(backtraceio.library.BuildConfig.VERSION_NAME, backtraceData.getAgentVersion()); + assertEquals("java", backtraceData.getLang()); + assertEquals("0", backtraceData.getLangVersion()); + assertEquals("", backtraceData.getSymbolication()); + assertEquals(report.timestamp, backtraceData.getTimestamp()); + assertEquals(report.uuid.toString(), backtraceData.getUuid()); + assertEquals(43, backtraceData.getAttributes().size()); + assertEquals(3, backtraceData.getAnnotations().size()); + assertEquals("instr: androidx.test.runner.androidjunitrunner", backtraceData.getMainThread()); + assertEquals(34, backtraceData.getSourceCode().size()); + assertTrue(!backtraceData.getThreadInformationMap().isEmpty()); + assertEquals(3, backtraceData.getAttachmentPaths().size()); + assertEquals("1", backtraceData.getAttributes().get("attr-1")); + assertEquals("true", backtraceData.getAttributes().get("attr-2")); + assertEquals("test", backtraceData.getAttributes().get("attr-3")); } }