-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes 3463 replace assert with assert that #5107
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package fr.free.nrw.commons.media; | ||
|
||
import static android.app.Activity.RESULT_CANCELED; | ||
import static android.app.Activity.RESULT_OK; | ||
import static android.view.View.GONE; | ||
|
@@ -11,6 +10,11 @@ | |
import static fr.free.nrw.commons.description.EditDescriptionConstants.WIKITEXT; | ||
import static fr.free.nrw.commons.upload.mediaDetails.UploadMediaDetailFragment.LAST_LOCATION; | ||
import static fr.free.nrw.commons.utils.LangCodeUtils.getLocalizedResources; | ||
//import org.junit.Test; | ||
//import static org.junit.Assert.assertThat; | ||
//import static org.hamcrest.Matchers.is; | ||
//import static org.hamcrest.Matchers.not; | ||
//import static org.hamcrest.Matchers.nullValue; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? |
||
import android.annotation.SuppressLint; | ||
import android.app.AlertDialog; | ||
import android.content.Context; | ||
|
@@ -991,6 +995,7 @@ public void onActivityResult(final int requestCode, final int resultCode, | |
|
||
if (requestCode == REQUEST_CODE && resultCode == RESULT_OK) { | ||
|
||
// assertThat(data, not(nullValue())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? |
||
assert data != null; | ||
final CameraPosition cameraPosition = LocationPicker.getCameraPosition(data); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,16 @@ package fr.free.nrw.commons.auth | |
import fr.free.nrw.commons.FakeContextWrapper | ||
import fr.free.nrw.commons.FakeContextWrapperWithException | ||
import fr.free.nrw.commons.TestCommonsApplication | ||
import org.junit.Assert | ||
import org.junit.Assert.* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind importing only the needed classes, explicitly? |
||
import org.junit.Before | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import org.robolectric.RobolectricTestRunner | ||
import org.robolectric.RuntimeEnvironment | ||
import org.robolectric.annotation.Config | ||
import org.hamcrest.CoreMatchers.*; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would you mind importing only the needed classes, explicitly? |
||
import org.hamcrest.MatcherAssert.assertThat; | ||
|
||
|
||
@RunWith(RobolectricTestRunner::class) | ||
@Config(sdk = [21], application = TestCommonsApplication::class) | ||
|
@@ -28,34 +31,34 @@ class AccountUtilUnitTest { | |
@Test | ||
@Throws(Exception::class) | ||
fun checkNotNull() { | ||
Assert.assertNotNull(accountUtil) | ||
assertThat(accountUtil, not(nullValue())); | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testGetUserName() { | ||
Assert.assertEquals(AccountUtil.getUserName(context), "[email protected]") | ||
assertThat(AccountUtil.getUserName(context), equalTo("[email protected]")) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testGetUserNameWithException() { | ||
val context = | ||
FakeContextWrapperWithException(RuntimeEnvironment.application.applicationContext) | ||
Assert.assertEquals(AccountUtil.getUserName(context), null) | ||
assertThat(AccountUtil.getUserName(context), not(nullValue())) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testAccount() { | ||
Assert.assertEquals(AccountUtil.account(context)?.name, "[email protected]") | ||
assertThat(AccountUtil.account(context)?.name, equalTo("[email protected]")) | ||
} | ||
|
||
@Test | ||
@Throws(Exception::class) | ||
fun testAccountWithException() { | ||
val context = | ||
FakeContextWrapperWithException(RuntimeEnvironment.application.applicationContext) | ||
Assert.assertEquals(AccountUtil.account(context), null) | ||
assertThat(AccountUtil.account(context), not(nullValue())) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,11 @@ version = "${VERSION_NAME}" | |
group = "${GROUP_ID}" | ||
|
||
android { | ||
compileSdkVersion 28 | ||
compileSdkVersion 30 | ||
|
||
defaultConfig { | ||
minSdkVersion 19 | ||
targetSdkVersion 28 | ||
targetSdkVersion 30 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this really needed? |
||
versionCode 1 | ||
versionName "${VERSION_NAME}" | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed?