Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Java Mock Data GeneratorNew to Visual Studio Code? Get it now.
Java Mock Data Generator

Java Mock Data Generator

krigans

|
2 installs
| (0) | Free
Generate mock data from JSON schema for Java testing
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Java Mock Data Generator

A VS Code extension that generates realistic mock data and Java test fixtures from JSON schemas. Perfect for testing Java applications with various data scenarios.

Features

  • Generate Mock JSON Data: Create realistic mock JSON data from a schema
  • Java Test Fixtures: Generate Java code with mock data for unit tests
  • Smart Field Detection: Automatically detects field types (email, phone, name, URL, etc.) and generates appropriate data
  • Configurable: Choose how many mock objects to generate
  • Webview UI: Interactive interface in VS Code sidebar for easy access
  • Command Palette: Quick commands for generating from JSON files

Installation

  1. Install from VS Code Extensions marketplace or download the .vsix file
  2. Reload VS Code

Usage

Method 1: Using the Sidebar Panel

  1. Click the Mock Data Generator icon in the VS Code activity bar
  2. Choose between:
    • Mock JSON: Paste your JSON schema and generate mock data
    • Java Code: Generate Java test fixture code

Method 2: Using Command Palette

  1. Open a JSON file with your schema
  2. Press Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (Mac)
  3. Choose:
    • Generate Mock Data from JSON - Creates JSON mock data
    • Generate Java Test Fixture from JSON - Creates Java test fixture code

Example Input

{
  "id": "number",
  "name": "string",
  "email": "string",
  "phone": "string",
  "createdAt": "date"
}

Generated Output

Mock JSON:

{
  "id": 547,
  "name": "John Doe",
  "email": "john.doe@example.com",
  "phone": "+1 (555) 123-4567",
  "createdAt": "2025-02-20T14:30:22.123Z"
}

Supported Field Types

  • Email: Fields containing "email"
  • Phone: Fields containing "phone" or "mobile"
  • Names: Fields containing "name", "firstname", "lastname"
  • Addresses: Fields containing "city", "address", "street", "country"
  • URLs: Fields containing "url" or "website"
  • Dates: Fields containing "date", "created", "updated"
  • IDs: Fields containing "id"
  • Descriptions: Fields containing "description" or "comment"

Type-based Generation

  • string: Random words or sentences
  • number, int, integer: Random numbers between 1-1000
  • double, float: Random decimal numbers
  • boolean, bool: Random true/false values

Extension Settings

No settings required! The extension works out of the box.

Requirements

  • VS Code 1.109.0 or higher
  • Node.js (for development)

Development

Local Setup

  1. Clone the repository
  2. Run npm install
  3. Press F5 to open the extension development window
  4. Make changes and reload the window

Building

npm run compile    # Compile TypeScript
npm run watch      # Watch for changes
npm run lint       # Run ESLint
npm run test       # Run tests

Note: The npm run watch task should be running whenever you develop this extension. It automatically compiles your TypeScript code to JavaScript as you save changes. VS Code will start this task automatically when you load the extension development window, but you can also start it manually with npm run watch or by pressing Cmd+Shift+B (Mac) / Ctrl+Shift+B (Windows/Linux).

Packaging

npm install -g vsce
vsce package

Known Limitations

  • Maximum 100 mock objects per generation
  • Nested objects and arrays are supported
  • Java code generation uses Jackson library for parsing

Release Notes

0.0.1

Initial release with core features:

  • Mock JSON data generation
  • Java test fixture code generation
  • Webview UI interface
  • Command palette integration
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft