forked from orhanobut/logger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
182 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 0 additions & 98 deletions
98
logger/src/androidTest/java/com/orhanobut/logger/LoggerTest.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,3 @@ | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.orhanobut.logger"> | ||
|
||
<application android:allowBackup="true"/> | ||
<manifest package="com.orhanobut.logger"> | ||
|
||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.orhanobut.logger; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricGradleTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
@RunWith(RobolectricGradleTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk = 21) | ||
public class LoggerTest { | ||
|
||
@Test | ||
public void testInit() { | ||
Settings settings = Logger.init(); | ||
assertThat(settings).isInstanceOf(Settings.class); | ||
|
||
settings = Logger.init("TAG"); | ||
assertThat(settings).isInstanceOf(Settings.class); | ||
} | ||
|
||
@Test | ||
public void testT() { | ||
Settings settings = Logger.t("tag").getSettings(); | ||
|
||
assertThat(settings.getMethodCount()).isEqualTo(2); | ||
|
||
settings = Logger.t(10).getSettings(); | ||
assertThat(settings.getMethodCount()).isEqualTo(2); | ||
|
||
settings = Logger.t("tag", 5).getSettings(); | ||
assertThat(settings.getMethodCount()).isEqualTo(2); | ||
|
||
Logger.init().setMethodCount(0); | ||
settings = Logger.t("tag").getSettings(); | ||
assertThat(settings.getMethodCount()).isEqualTo(0); | ||
} | ||
|
||
} |
82 changes: 82 additions & 0 deletions
82
logger/src/test/java/com.orhanobut.logger/SettingsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.orhanobut.logger; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.RobolectricGradleTestRunner; | ||
import org.robolectric.annotation.Config; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* @author Orhan Obut | ||
*/ | ||
@RunWith(RobolectricGradleTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk = 21) | ||
public class SettingsTest extends TestCase { | ||
|
||
private Settings settings; | ||
|
||
@Before | ||
public void setup() { | ||
settings = new Settings(); | ||
} | ||
|
||
@After | ||
public void tearDown() { | ||
settings = null; | ||
} | ||
|
||
@Test | ||
public void testDefaultShowThreadInfo() { | ||
assertThat(settings.isShowThreadInfo()).isTrue(); | ||
} | ||
|
||
@Test | ||
public void testCustomShowThreadInfo() { | ||
settings.hideThreadInfo(); | ||
assertThat(settings.isShowThreadInfo()).isFalse(); | ||
} | ||
|
||
@Test | ||
public void testDefaultLogLevel() { | ||
assertThat(settings.getLogLevel()).isEqualTo(LogLevel.FULL); | ||
} | ||
|
||
@Test | ||
public void testCustomLogLevel() { | ||
settings.setLogLevel(LogLevel.NONE); | ||
assertThat(settings.getLogLevel()).isEqualTo(LogLevel.NONE); | ||
|
||
settings.setLogLevel(LogLevel.FULL); | ||
assertThat(settings.getLogLevel()).isEqualTo(LogLevel.FULL); | ||
} | ||
|
||
@Test | ||
public void testMethodCount() { | ||
//default | ||
assertThat(settings.getMethodCount()).isEqualTo(2); | ||
|
||
settings.setMethodCount(4); | ||
assertThat(settings.getMethodCount()).isEqualTo(4); | ||
|
||
//negative values should be convert to 0 | ||
settings.setMethodCount(-10); | ||
assertThat(settings.getMethodCount()).isEqualTo(0); | ||
} | ||
|
||
@Test | ||
public void testMethodOffset() { | ||
//default | ||
assertThat(settings.getMethodOffset()).isEqualTo(0); | ||
|
||
settings.setMethodOffset(10); | ||
assertThat(settings.getMethodOffset()).isEqualTo(10); | ||
|
||
settings.setMethodOffset(-10); | ||
assertThat(settings.getMethodOffset()).isEqualTo(-10); | ||
} | ||
} |