Skip to content

Instantly share code, notes, and snippets.

@turkergoksu
Last active May 9, 2020 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turkergoksu/f772f1aee72d68166678911d86b8f34d to your computer and use it in GitHub Desktop.
Save turkergoksu/f772f1aee72d68166678911d86b8f34d to your computer and use it in GitHub Desktop.
YTT_Odev_Test_Cases
package me.turkergoksu.yazilimsinama
import junit.framework.TestCase
import org.junit.Test
/**
* Created by turkergoksu on 09-May-20, 7:33 AM
*/
class AccountUtilTest : TestCase() {
private val accountUtil = AccountUtil()
/*
Test 1: Tüm inputları boş olarak girmek
*/
@Test
fun testChangePassword_EmptyInputs() {
assertEquals(false, accountUtil.changePassword("", "", "").isSuccess)
}
/*
Test 2: Tüm inputları dogru girmek
*/
@Test
fun testChangePassword_CorrectInputs() {
assertEquals(
true,
accountUtil.changePassword("123456", "yeniparola", "yeniparola").isSuccess
)
}
/*
Test 3: Eski parolayı yanlış girmek
*/
@Test
fun testChangePassword_WrongOldPassword() {
assertEquals(
false,
accountUtil.changePassword("abcdef", "yeniparola", "yeniparola").isSuccess
)
}
/*
Test 4: Yeni parolanın eski parola ile aynı olması
*/
@Test
fun testChangePassword_NewPasswordEqualsToOldPassword() {
assertEquals(false, accountUtil.changePassword("123456", "123456", "123456").isSuccess)
}
/*
Test 5: Onaylama parolasını yanlış girmek
*/
@Test
fun testChangePassword_WrongConfirmPassword() {
assertEquals(
false,
accountUtil.changePassword("123456", "yeniparola", "yeniparolaa").isSuccess
)
}
/*
Test 6: Yeni parolanın karakter uzunlugunun 6'dan kücük olması
*/
@Test
fun testChangePassword_PasswordLengthShouldBeTaller() {
assertEquals(false, accountUtil.changePassword("123456", "yenip", "yenip").isSuccess)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment