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
@TestWith({ | |
"0", | |
"1", | |
"2" | |
}) | |
public void AddScore_AddPositiveScore_IncreaseExistingScore(int value) throws Exception { | |
final UserScoreRepository userScoreRepositoryStub = Make_FakeUserScoreRepository(); | |
final User fakeUser = Make_User(); | |
final UserScoreService userScore = new UserScoreService(userScoreRepositoryStub); |
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
@Test | |
public void GetScore_GetForNotExistingUser_ThrowException() { | |
final UserScoreRepository userScoreRepositoryStub = Make_FakeUserScoreRepository(); | |
final UserScoreService userScore = new UserScoreService(userScoreRepositoryStub); | |
final User fakeUser = null; | |
try { | |
final int userPoints = userScore.get(fakeUser); | |
} catch (IllegalArgumentException e) { | |
final String errorMessage = "User Is null"; |
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
public boolean isValid(final CharSequence email) { | |
return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches(); | |
} |
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
createNotification(Calendar.getInstance().getTimeInMillis(), "hey!"); | |
public static final String NOTIFICATION_DATA = "NOTIFICATION_DATA"; | |
private void createNotification(long when, String data){ | |
String notificationContent ="Notification Content Click Here to go more details"; | |
String notificationTitle ="This is Notification"; | |
//large icon for notification,normally use App icon | |
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher); | |
int smalIcon =R.drawable.ic_launcher; | |
String notificationData="This is data : "+data; |
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
// Handles back button inside WebView. | |
// When user clicks back button and web history is not empty shows previous page from history. | |
mWebView.setOnKeyListener( new View.OnKeyListener() { | |
@Override | |
public boolean onKey( View v, int keyCode, KeyEvent event ) { | |
if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()) { | |
mWebView.goBack(); | |
return true; | |
} |
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
package com.mydriver.customer.ui.common.custom; | |
import android.content.Context; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.ViewParent; | |
import android.widget.DatePicker; | |
/** |
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
import android.app.Fragment; | |
import android.app.FragmentManager; | |
import android.app.FragmentTransaction; | |
import org.junit.runners.model.InitializationError; | |
import org.robolectric.RobolectricTestRunner; | |
/** | |
* Customized test runner based on {@link org.robolectric.RobolectricTestRunner}. | |
* | |
* Creator: <lukasz.izmajlowicz@mydriver.com> |
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
@Test | |
public void homeButtonHidesKeyboard() { | |
final MenuItem item = mock(MenuItem.class); | |
when(item.getItemId()).thenReturn(android.R.id.home); | |
testedFragment.onOptionsItemSelected(item); | |
verify(keyboardHackerMock).hideKeyboardAndResetBottomPaddingFor(any(View.class)); | |
} |
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
import android.content.SharedPreferences; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.robolectric.Robolectric; | |
import org.robolectric.RobolectricTestRunner; | |
import static org.junit.Assert.assertEquals; | |
@RunWith(RobolectricTestRunner.class) | |
public class TheLastSyncTimestamp { |
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
#!/bin/sh | |
# Command to set date for running device: | |
# adb shell date -s yyyymmdd.hhmmss | |
now="$(date +'%Y%m%d')" | |
adb shell date -s $now.$1$2 |
OlderNewer