Content ITV PRO
This is Itvedant Content department
FinCheck Conditional Logic for Transaction Validation
Business Scenario
After Successfully understanding Variables, Data Types, and Operators inside Java Programs, your manager now assigns you responsibility for validating Transaction Conditions inside the FinCheck Banking System.
During Banking Transaction Processing, the system continuously checks multiple Conditions before allowing transactions.
Recently, FinCheck Users reported several Validation-Related Issues :-
Transactions Processed with Insufficient Balance
Negative Transaction Amounts Accepted
Inactive Accounts Allowed Transactions
Invalid Transaction Types Processed Successfully
Before starting validation activities, your manager clearly says :-
“A QA Tester must understand how applications make Decisions using Conditions and Validations. ”
Your responsibility is to understand :-
How Conditional Statements Work
How Transaction Validations are Performed
How Valid and Invalid Scenarios are Handled
How Java Programs Make Decisions
How Testing Conditions are Verified inside Applications
Pre-Lab Preparation
Task 1: Understand if-else Validation
Understand if Condition
a
What is if Condition?
if condition is used to execute code only when specified condition becomes true.
QA testers use conditions to validate :-
transaction amount
account balance
transaction type
account status
How if Condition Works
Condition gets checked.
1. If condition becomes true :- program executes validation block.
2. If condition becomes false :- program skips validation block.
Real Life Example
Transaction amount = 5000
If amount is greater than 0 :- transaction becomes valid.
Syntax
if (conditional) {
// run code with condition is true
}If condition
Activity
1. Validate Positive Transaction Amount using If Condition in Java
Create transaction amount variable and assigned 10000 in it.
Apply if condition to validate transaction amount should be greater than 0
Print validate result
Execute java program
2. Validate Transaction Type using equalsIgnoreCase()
Create a transaction type variable and Assigned debit in it.
Apply if condition to validate transaction type with Debit
Print validate result
Execute java program
Task 2: Understand if-else Validation
Understand if-else Condition
a
What is if-else Condition?
if-else condition handles both valid and invalid scenario
Here Else will only run when if condition is not true.
How if-else Works
If condition becomes true :-
valid block executes.
Otherwise :-
else block executes.
Real Life Example
If balance available :-
transaction allowed.
Else :-
transaction rejected.
if (condition){
// run code when condition it true
}else{
// run code when condition it true
}Syntax
Activity
1. Validate Withdrawal Amount using If-Else Condition in Java
Create Account amount variable and assigned 10000 in it.
Create withdrawal amount variable and assigned 500 in it.
Apply if-else condition where compare account balance should be greater than withdrawal amount
Print validate result
Execute java program
2. Validate Account Status using equals()
Create account status variable and assigned ACTIVE in it.
Apply if-else condition to validate account status with “ACTIVE”
Print validate result
Execute java program
Task 3: Understand Nested Validation Logic
Understand Nested Conditions
a
What are Nested Conditions?
Nested conditions are conditions written inside another condition.
QA testers use nested validations when multiple banking rules must be checked step-by-step.
How Nested Conditions Work
First condition gets validated.
If first condition becomes true :-
second condition gets checked.
System processes transaction only when all required validations become true.
Real Life Example
System validates :-
account active
AND
balance available
Only then transaction becomes successful.
if (condition 1) {
// run code when condition 1 is true
if (condition 2) {
// run code when condition 1 is true and condition 2 is true
}else{
// run code when condition 1 is true but condition 2 is false }
}else{
// run code when condition 1 is false
if(condition 3) {
// run code when condition 1 is false and condition 3 is true
}else {
// run code when condition 1 is false and condition 3 is false }
}Activity
Create account balance variable
Create account status variable
Create withdrawal amount variable
Apply nested if conditions
On first condition Check account status
On second condition Check balance amount should Greater than withdrawal amount
Print validation result
Create account status variable assigned ACTIVE on it.
Create transaction type variable debit on it.
Apply nested if conditions
On first condition validate account status with “ACTIVE” with equal
On Second condition validate transaction type with “Debit” with equalIgnoreCase
Print validation result
Task 4: Understand Logical Operators
Understand Logical Operators
a
What are Logical Operators?
Logical operators combine multiple conditions during validation.
QA testers use logical operators when multiple validations are required together.
Types of Logical Operators
AND Operator (&&)
Returns true when both conditions become true.
OR Operator (||)
Returns true when at least one condition becomes true.
NOT Operator (!)
Reverses condition result.
Real Life Example
Transaction allowed only when :-
balance active
AND
account available
Use cases Syntax
AND Operator
if (condition1 && condition2){
// run code when all condition is true
}else{
// run code when one or all condition is false
}OR Operator
if (condition1 || condition2){
// run code when any one condition is true
}else{
// run code when all condition is false
}NOT Operator
if (!condition) {
//run code when condition is false
}else{
//run code when condition is true
}Activity
Create balance variable Assigned 15000 on it.
Create account status variable Assigned Active on it.
Create withdrawal amount variable Assigned 5000 on it.
Apply logical condition using AND operator
Validate balance should be greater than withdrawal amount
Validate account status should be ACTIVE
Print validation output
Execute Java program
Verify final result in console output
Task 5: Validate Transaction Scenarios
Understand Validation Scenarios
a
What are Validation Scenarios?
Validation scenarios help testers verify whether system correctly handles :-
valid transactions
invalid transactions
unexpected inputs
Types of Validation Scenarios
Valid Transaction
Transaction follows all banking rules.
Invalid Transaction
Transaction violates validation rules.
How Validation Scenario Works
System checks transaction value.
If value follows validation rules :-
transaction becomes valid.
Otherwise :-
transaction becomes invalid.
Real Life Example
Amount = 5000 → Valid Transaction
Amount = -500 → Invalid Transaction
Activity
Create transaction amount variable Assigned -500 on it
Apply validation condition using if-else statement
Validate transaction amount should be greater than 0
If amount is greater than 0 print valid transaction message
Otherwise print invalid transaction message
Execute Java program
Verify final result in console output
Good Job!!
In this lab, you learned about Conditional Statements, If-Else Conditions, Logical Operators, and Decision-Making Logic in Java.
You also practiced Validating Transaction Amounts, checking Account Balances, performing Multiple Validations, and analyzing Validation Outputs.
By completing this lab, you now understand how QA Testers Validate Banking Rules and Handle Transaction Validation Scenarios using Java Conditions.
Checkpoint
Next-Lab Preparation
Git Push
git push origin branchNameBy Content ITV