Skip to content

Commit

Permalink
A public api, permalink, a bank account
Browse files Browse the repository at this point in the history
  • Loading branch information
Rd4dev committed Aug 20, 2024
1 parent 8dd0eb2 commit c102d7f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions wiki/Writing-tests-with-good-behavioural-coverage.md
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ This function checks various conditions on the input string text to determine wh

The goal when testing domain errors is to ensure that the application correctly identifies and responds to these errors as part of its normal operation.

**Test samples from [FractionParserTest.kt](https://github.com/oppia/oppia-android/blob/develop/utility/src/test/java/org/oppia/android/util/math/FractionParserTest.kt):**
**Test samples from [FractionParserTest.kt](https://github.com/oppia/oppia-android/blob/f9106d91297abd09b24da25d5485deb8473b0125/utility/src/test/java/org/oppia/android/util/math/FractionParserTest.kt#L19):**

```kotlin
@Test
Expand Down Expand Up @@ -777,7 +777,7 @@ A public API (Application Programming Interface) refers to the set of methods, p

Public APIs are essential because they provide a way to interact with the functionality of a class or module without exposing its internal workings. They define how external code can use the functionality offered by the class or module, ensuring that interactions are safe and predictable while keeping the internal implementation hidden and secure.

Let's consider the following example for a public API to withdraw money from the BankAccount.
Let's consider the following example for a public API to withdraw money from a BankAccount.

```kotlin
class BankAccount(
Expand Down Expand Up @@ -833,7 +833,7 @@ class BankAccount(

The **`withdraw`** method serves as the single public entry point for withdrawing money from the account. It handles user validation, amount checking, optional file upload and printing of the receipt. By keeping the internal methods private, the class ensures that the operations are performed in a controlled manner while hiding the complexity of these operations from the user.

## How to Write Tests for Public API
## How to Write Tests for a Public API

```sh
+---------+ +---------------+ +-----------+ +--------+
Expand Down

0 comments on commit c102d7f

Please sign in to comment.