sort_codeBanking

Mock Jutsu HOW-TO | EN

In the specialized landscape of financial software development, generating realistic test data is a critical step for ensuring system integrity and regulatory compliance. The mock-jutsu library provides a robust utility via its sort_code function, specifically designed to produce authentic UK bank identifiers. This function generates a six-digit number formatted as three pairs of digits separated by hyphens, such as 20-00-00. By integrating this into your development workflow, you can simulate banking transactions and account setup processes without relying on sensitive, real-world information, thereby maintaining high security standards during the initial phases of the software development lifecycle.

The sort_code generator adheres to the structural standards utilized by the United Kingdom's banking industry, where these codes represent specific bank branches and clearing houses. While the mock-jutsu library focuses on formatting and structural accuracy, it allows developers to populate databases with mock data that passes basic validation checks for length and character patterns. This is particularly useful when building applications that interact with BACS, CHAPS, or Faster Payments systems, as it ensures that the user interface and backend logic can handle the specific string patterns required for British financial routing and settlement.

Testing scenarios for the sort_code function are diverse, ranging from simple form validation to complex end-to-end payment processing simulations. For instance, developers can use this test data to verify that input masks on a web frontend correctly handle hyphenation or to ensure that a database schema properly stores the eight-character string. Furthermore, when conducting load testing or stress testing on financial APIs, mock-jutsu provides a consistent stream of unique values to prevent primary key collisions or caching bias in the testing environment, ensuring that performance benchmarks remain accurate and representative of real-world usage.

One of the primary benefits of using mock-jutsu is its versatility across different environments and tech stacks. Whether you are working directly in a Python script using the jutsu.generate('sort_code') method, executing quick checks via the CLI with mockjutsu generate sort_code, or performing performance benchmarks in JMeter with the ${__mockjutsu(sort_code,)} syntax, the library ensures a seamless experience. This flexibility significantly reduces the overhead of manual data creation, allowing engineers to focus on refining business logic rather than formatting strings. By leveraging this tool, teams can accelerate their CI/CD pipelines and improve the overall reliability of their banking software suites.

CLI Usage
mockjutsu generate sort_codemockjutsu bulk sort_code --count 10mockjutsu export sort_code --count 10 --format jsonmockjutsu export sort_code --count 10 --format csvmockjutsu export sort_code --count 10 --format sql# --mask: regulation-compliant output (PCI DSS / GDPR / KVKK)mockjutsu generate sort_code --maskmockjutsu bulk sort_code --count 5 --mask
Python API
from mockjutsu import jutsujutsu.generate('sort_code')jutsu.bulk('sort_code', count=10)jutsu.template(['sort_code'], count=5)# mask=True: regulation-compliant outputjutsu.generate('sort_code', mask=True)jutsu.bulk('sort_code', count=5, mask=True)
JMeter
${__mockjutsu_banking(sort_code)}# JMeter Function: __mockjutsu_banking# Parameter 1: sort_code# Parameter 2: (not required for this function)# Add 'mask' keyword to get a regulation-compliant masked value${__mockjutsu_banking(sort_code,mask)}
REST API
GET /generate/sort_code# → {"type":"sort_code","result":"...","status":"ok"}GET /bulk/sort_code?count=10POST /template {"types":["sort_code"],"count":1}# mask=true: regulation-compliant outputGET /generate/sort_code?mask=trueGET /bulk/sort_code?count=5&mask=true

Parameters

Parameter Values Description
--mask true | false Return a regulation-compliant masked value (PCI DSS, GDPR, KVKK…)

Other Languages