Skip to content

Commit

Permalink
Testing refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
vian21 committed Dec 5, 2023
1 parent 7ae9cbf commit b601529
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies {
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("org.testng:testng:6.9.6")
testImplementation("junit:junit:4.13.2")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
package com.example.seg2105_project;

import org.testng.annotations.Test;
import static org.testng.Assert.assertTrue;
import static org.testng.Assert.assertFalse;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

import org.junit.Test;

public class MainActivityTest {

@Test
public void testValidEmail() {
assertTrue(MainActivity.validEmail("[email protected]"));
}

public void testInvalidEmail() {
assertFalse(MainActivity.validEmail("invalid-email"));
}

@Test
public void testValidPassword() {
assertTrue(MainActivity.validPassword("Password123"));
}

@Test
public void testInvalidShortPassword() {
assertFalse(MainActivity.validPassword("short"));
assertFalse(MainActivity.validPassword("nouppercase123"));
assertFalse(MainActivity.validPassword("NOLOWER123"));
assertFalse(MainActivity.validPassword("noDigitUpperCase"));
}

}

0 comments on commit b601529

Please sign in to comment.