-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the builds and tests work again with updated dependencies
- Loading branch information
Showing
20 changed files
with
161 additions
and
167 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
package pl.brightinventions.slf4android.androidTest; | ||
|
||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; | ||
|
||
import android.app.Application; | ||
import android.test.ActivityInstrumentationTestCase2; | ||
|
||
import androidx.test.rule.ActivityTestRule; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
|
@@ -11,7 +16,7 @@ | |
import pl.brightinventions.slf4android.LoggerConfiguration; | ||
import pl.brightinventions.slf4android.NotifyDeveloperHandler; | ||
|
||
public class NotifyDeveloperHandlerTests extends ActivityInstrumentationTestCase2<TestActivity> { | ||
public class NotifyDeveloperHandlerTests extends ActivityTestRule<TestActivity> { | ||
|
||
private Logger LOG; | ||
private NotifyDeveloperHandler handler; | ||
|
@@ -20,30 +25,32 @@ public NotifyDeveloperHandlerTests() { | |
super(TestActivity.class); | ||
} | ||
|
||
@Override | ||
protected void setUp() throws Exception { | ||
@Before | ||
public void setUp() { | ||
LoggerConfiguration.resetConfigurationToDefault(); | ||
LoggerConfiguration configuration = LoggerConfiguration.configuration(); | ||
Application targetContext = (Application) getInstrumentation().getTargetContext().getApplicationContext(); | ||
handler = configuration.notifyDeveloperHandler(targetContext, "[email protected]"); | ||
configuration.addHandlerToLogger("", handler); | ||
LOG = LoggerFactory.getLogger(getClass().getSimpleName()); | ||
super.setUp(); | ||
} | ||
|
||
public void test_dont_send_message_with_level_lower_than_error() throws Exception { | ||
@Test | ||
public void test_dont_send_message_with_level_lower_than_error() { | ||
getActivity(); | ||
LOG.warn("Hello"); | ||
} | ||
|
||
@Test | ||
public void test_send_message_with_level_error() throws Exception { | ||
getActivity(); | ||
LOG.warn("Hello"); | ||
LOG.error("Send email", new NullPointerException("A test message")); | ||
Thread.sleep(TimeUnit.SECONDS.toMillis(15)); | ||
} | ||
|
||
public void test_send_message_with_custom_subject_body_with_level_error() throws Exception{ | ||
@Test | ||
public void test_send_message_with_custom_subject_body_with_level_error() throws Exception { | ||
handler.withSubject("Błąd").withBody("Podaj szczegóły błędu: "); | ||
getActivity(); | ||
LOG.warn("Hello"); | ||
|
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
Oops, something went wrong.