-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge hotfixes for travis build and coverage
Hotfixes 0.1.1
- Loading branch information
Showing
7 changed files
with
203 additions
and
47 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
24 changes: 0 additions & 24 deletions
24
...t/java/fr/paris10/projet/assogenda/assogenda/ui/fragment/AssociationMainFragmentTest.java
This file was deleted.
Oops, something went wrong.
50 changes: 50 additions & 0 deletions
50
...java/fr/paris10/projet/assogenda/assogenda/ui/activites/AssociationDashboardRoboTest.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,50 @@ | ||
package fr.paris10.projet.assogenda.assogenda.ui.activites; | ||
|
||
import android.widget.Button; | ||
|
||
import com.google.firebase.FirebaseApp; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.Robolectric; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.RuntimeEnvironment; | ||
import org.robolectric.annotation.Config; | ||
|
||
import fr.paris10.projet.assogenda.assogenda.BuildConfig; | ||
import fr.paris10.projet.assogenda.assogenda.R; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk = 22) | ||
|
||
public class AssociationDashboardRoboTest { | ||
private AssociationDashboardActivity activity; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
FirebaseApp.initializeApp(RuntimeEnvironment.application.getApplicationContext()); | ||
activity = Robolectric.buildActivity(AssociationDashboardActivity.class).create().get(); | ||
} | ||
|
||
@Test | ||
public void shouldNotBeNull() throws Exception { | ||
assertNotNull(activity); | ||
} | ||
|
||
@Test | ||
public void shouldHaveMainFragment() throws Exception { | ||
assertNotNull(activity.getFragmentManager() | ||
.findFragmentById(R.id.activity_association_dashboard_fragment_container)); | ||
} | ||
|
||
@Test | ||
public void onCreateAsso() throws Exception { | ||
Button button = (Button) activity.findViewById(R.id.fragment_association_main_button_create_association); | ||
assertNotNull(button); | ||
assertTrue(button.performClick()); | ||
} | ||
|
||
} |
67 changes: 67 additions & 0 deletions
67
...c/test/java/fr/paris10/projet/assogenda/assogenda/ui/activites/LoginActivityRoboTest.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,67 @@ | ||
package fr.paris10.projet.assogenda.assogenda.ui.activites; | ||
|
||
import android.widget.Button; | ||
import android.widget.TextView; | ||
|
||
import com.google.firebase.FirebaseApp; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.Robolectric; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.RuntimeEnvironment; | ||
import org.robolectric.annotation.Config; | ||
|
||
import fr.paris10.projet.assogenda.assogenda.BuildConfig; | ||
import fr.paris10.projet.assogenda.assogenda.R; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.junit.Assert.assertTrue; | ||
import static org.robolectric.Shadows.shadowOf; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk=22) | ||
|
||
public class LoginActivityRoboTest { | ||
private LoginActivity activity; | ||
private final String textEmail = "[email protected]"; | ||
private final String textPwd = "strongpassword"; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
FirebaseApp.initializeApp(RuntimeEnvironment.application.getApplicationContext()); | ||
activity = Robolectric.buildActivity(LoginActivity.class).create().get(); | ||
} | ||
|
||
@Test | ||
public void shouldNotBeNull() throws Exception { | ||
assertNotNull(activity); | ||
} | ||
|
||
@Test | ||
public void fillFields() throws Exception { | ||
TextView email = (TextView) activity.findViewById(R.id.login_email); | ||
TextView password = (TextView) activity.findViewById(R.id.login_password); | ||
assertNotNull(email); | ||
assertNotNull(password); | ||
email.setText(textEmail); | ||
password.setText(textPwd); | ||
assertEquals(email.getText().toString(), textEmail); | ||
assertEquals(password.getText().toString(), textPwd); | ||
} | ||
|
||
@Test | ||
public void shouldNotSignedIn() throws Exception { | ||
activity.signIn(textEmail, textPwd); | ||
assertEquals(null, shadowOf(activity).peekNextStartedActivity()); | ||
TextView email = (TextView) activity.findViewById(R.id.login_email); | ||
TextView password = (TextView) activity.findViewById(R.id.login_password); | ||
Button logInButton = (Button) activity.findViewById(R.id.login_validate); | ||
assertNotNull(logInButton); | ||
assertTrue(logInButton.performClick()); | ||
assertEquals(null, shadowOf(activity).peekNextStartedActivity()); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...rc/test/java/fr/paris10/projet/assogenda/assogenda/ui/activites/MainActivityRoboTest.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,46 @@ | ||
package fr.paris10.projet.assogenda.assogenda.ui.activites; | ||
|
||
import android.content.Intent; | ||
import android.test.mock.MockContext; | ||
|
||
import com.google.firebase.FirebaseApp; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
import org.robolectric.Robolectric; | ||
import org.robolectric.RobolectricTestRunner; | ||
import org.robolectric.RuntimeEnvironment; | ||
import org.robolectric.annotation.Config; | ||
|
||
import fr.paris10.projet.assogenda.assogenda.BuildConfig; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
import static org.robolectric.Shadows.shadowOf; | ||
|
||
@RunWith(RobolectricTestRunner.class) | ||
@Config(constants = BuildConfig.class, sdk = 22) | ||
|
||
public class MainActivityRoboTest { | ||
private MainActivity activity; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
FirebaseApp.initializeApp(RuntimeEnvironment.application.getApplicationContext()); | ||
activity = Robolectric.setupActivity(MainActivity.class); | ||
} | ||
|
||
@Test | ||
public void shouldNotBeNull() throws Exception { | ||
assertNotNull(activity); | ||
} | ||
|
||
@Test | ||
public void startNewActivityIfNotLoggedIn() throws Exception { | ||
activity.redirectIfNotLoggedIn(); | ||
Intent expectedIntent = shadowOf(activity).peekNextStartedActivity(); | ||
assertEquals(LoginActivity.class.getCanonicalName(), | ||
expectedIntent.getComponent().getClassName()); | ||
} | ||
} |
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