Agent skill

Java Test Updater

by ArabelaTso in ArabelaTso/Skills-4-SE

Update Java test classes and methods to work with new code versions after refactoring or modifications.

Apache-2.0Auto-check passedDevelopment

Install Java Test Updater

skills CLI
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/java-test-updater .claude/skills/java-test-updater && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
java-test-updater
GitHub stars
253
Token cost
~3k tokens
SKILL.md length
589 words
Files
1
Skills in repo
150
Repo updated
First seen
Licence
Apache-2.0

At a glance

Update Java test classes and methods to work with new code versions after refactoring or modifications.

  • Works in 10 steps: Analyze Code Changes → Analyze Existing Tests → Update Method Calls → …
  • Code changes break existing tests due to signature changes
  • SKILL.md covers Overview, Workflow, Update Patterns and Tips
  • Calls mvn

What it does

Java Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Update Java test classes and methods to work with new code versions after refactoring or modifications. Use when code changes break existing tests due to signature changes, refactoring, or behavior modifications. Takes old and new code versions plus old tests as input, and outputs updated tests that compile and pass against the new code. Handles method signature changes, class refactoring, assertion updates, and mock modifications.

Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Refactoring. It works with Java. The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.

When your agent uses it

  • Code changes break existing tests due to signature changes
  • Behavior modifications

Example prompts

  • “/java-test-updater”

Workflow steps

10 steps, taken from the step headings in SKILL.md.

  1. Analyze Code Changes
  2. Analyze Existing Tests
  3. Update Method Calls
  4. Update Assertions
  5. Update Mocks and Stubs
  6. Add New Test Cases
  7. Update Test Setup and Teardown
  8. Verify Compilation
  9. Run and Verify Tests
  10. Validate Test Quality

What it can do on your machine

Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • mvn

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Java Test Updater loads about 3k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 589 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~113
When it runs · the whole SKILL.md, loaded when a task matches
~3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 589 words, ~2,966 tokens.

Download SKILL.mdSave it as .claude/skills/java-test-updater/SKILL.md (or your agent's skills folder).
name
java-test-updater
description
Update Java test classes and methods to work with new code versions after refactoring or modifications. Use when code changes break existing tests due to signature changes, refactoring, or behavior modifications. Takes old and new code versions plus old tests as input, and outputs updated tests that compile and pass against the new code. Handles method signature changes, class refactoring, assertion updates, and mock modifications.

Java Test Updater

Overview

Automatically update Java test code to align with changes in production code, ensuring tests compile and pass after refactoring, signature changes, or behavior modifications.

Workflow

1. Analyze Code Changes

Compare old and new versions of the production code to identify changes:

Read both versions:

  • Old code version (before changes)
  • New code version (after changes)
  • Identify the specific class and methods that changed

Categorize changes:

  • Signature changes: Parameter types, parameter order, return type, method name
  • Refactoring: Class renamed, method moved, package changed
  • Behavior changes: Logic modified, new exceptions, different return values
  • API changes: New methods added, old methods removed

Example change analysis:

java
// Old version
public double calculateDiscount(double price) {
    return price * 0.1;
}

// New version
public double calculateDiscount(double price, double discountRate) {
    if (discountRate < 0 || discountRate > 1) {
        throw new IllegalArgumentException("Invalid discount rate");
    }
    return price * discountRate;
}

Identified changes:

  • Added parameter: discountRate
  • Added validation with exception
  • Changed calculation logic
2. Analyze Existing Tests

Read and understand the old test code:

Identify test structure:

  • Test class name and package
  • Test methods and their purposes
  • Setup and teardown methods (@Before, @BeforeEach, @After, @AfterEach)
  • Test data and fixtures
  • Mocks and stubs used

Map tests to code changes:

  • Which tests call the changed methods
  • Which assertions depend on changed behavior
  • Which mocks need updating

Example old test:

java
@Test
public void testCalculateDiscount() {
    double price = 100.0;
    double result = calculator.calculateDiscount(price);
    assertEquals(10.0, result, 0.01);
}
3. Update Method Calls

Modify test code to match new method signatures:

For added parameters:

java
// Old call
calculator.calculateDiscount(price)

// Updated call
calculator.calculateDiscount(price, 0.1)  // Use appropriate default or test value

For removed parameters:

java
// Old call
calculator.calculateDiscount(price, taxRate, shippingCost)

// Updated call (if taxRate removed)
calculator.calculateDiscount(price, shippingCost)

For parameter type changes:

java
// Old call
calculator.process(userId)  // userId was int

// Updated call (if userId changed to Long)
calculator.process(Long.valueOf(userId))

For renamed methods:

java
// Old call
calculator.computeTotal()

// Updated call (if renamed to calculateTotal)
calculator.calculateTotal()

For moved methods:

java
// Old call
calculator.validateInput(data)

// Updated call (if moved to validator class)
validator.validateInput(data)
4. Update Assertions

Adjust test assertions to match new behavior:

For changed return values:

java
// Old assertion (10% fixed discount)
assertEquals(10.0, result, 0.01);

// Updated assertion (variable discount rate)
assertEquals(8.0, calculator.calculateDiscount(100.0, 0.08), 0.01);

For new exceptions:

java
// Add new test for exception
@Test
public void testInvalidDiscountRate() {
    assertThrows(IllegalArgumentException.class, () -> {
        calculator.calculateDiscount(100.0, -0.1);
    });
}

For changed behavior:

java
// Old assertion
assertTrue(result.isEmpty());

// Updated assertion (if behavior changed to return null instead)
assertNull(result);

For modified object state:

java
// Old assertion
assertEquals(1, cart.getItemCount());

// Updated assertion (if implementation changed)
assertEquals(1, cart.getItems().size());
5. Update Mocks and Stubs

Modify mock objects to match new interfaces:

For Mockito mocks with signature changes:

java
// Old mock setup
when(repository.findById(userId)).thenReturn(user);

// Updated mock setup (if return type changed to Optional)
when(repository.findById(userId)).thenReturn(Optional.of(user));

For added parameters in mocked methods:

java
// Old mock
when(service.process(data)).thenReturn(result);

// Updated mock (if parameter added)
when(service.process(data, context)).thenReturn(result);
// Or use argument matchers
when(service.process(eq(data), any(Context.class))).thenReturn(result);

For changed mock behavior:

java
// Old mock (method returned boolean)
when(validator.isValid(input)).thenReturn(true);

// Updated mock (method now throws exception instead)
doNothing().when(validator).validate(input);
// Or for invalid case:
doThrow(new ValidationException()).when(validator).validate(invalidInput);
6. Add New Test Cases

Create additional tests for new functionality or edge cases:

For new parameters:

java
@Test
public void testCalculateDiscountWithZeroRate() {
    double result = calculator.calculateDiscount(100.0, 0.0);
    assertEquals(0.0, result, 0.01);
}

@Test
public void testCalculateDiscountWithMaxRate() {
    double result = calculator.calculateDiscount(100.0, 1.0);
    assertEquals(100.0, result, 0.01);
}

For new exceptions:

java
@Test
public void testNegativeDiscountRate() {
    assertThrows(IllegalArgumentException.class, () -> {
        calculator.calculateDiscount(100.0, -0.5);
    });
}

@Test
public void testDiscountRateAboveOne() {
    assertThrows(IllegalArgumentException.class, () -> {
        calculator.calculateDiscount(100.0, 1.5);
    });
}

For new behavior:

java
@Test
public void testNewFeature() {
    // Test newly added functionality
    Result result = service.newMethod(input);
    assertNotNull(result);
    assertEquals(expectedValue, result.getValue());
}
7. Update Test Setup and Teardown

Modify test fixtures if dependencies changed:

For constructor changes:

java
// Old setup
@BeforeEach
void setUp() {
    calculator = new Calculator();
}

// Updated setup (if constructor now requires dependencies)
@BeforeEach
void setUp() {
    validator = new Validator();
    calculator = new Calculator(validator);
}

For new dependencies:

java
// Old setup
@Mock
private Repository repository;

// Updated setup (if new dependency added)
@Mock
private Repository repository;

@Mock
private CacheService cacheService;

@BeforeEach
void setUp() {
    service = new Service(repository, cacheService);
}
8. Verify Compilation

Ensure updated tests compile without errors:

Check for compilation issues:

  • Import statements are correct
  • All types are resolved
  • Method signatures match
  • No syntax errors

Common compilation fixes:

java
// Add missing imports
import java.util.Optional;
import static org.mockito.ArgumentMatchers.any;

// Fix type mismatches
Long userId = 123L;  // Instead of int userId = 123;

// Update generic types
List<String> items = new ArrayList<>();  // Instead of raw List

Compile tests:

bash
# Maven
mvn test-compile

# Gradle
./gradlew testClasses
Show full SKILL.md (255 more words)Show less
9. Run and Verify Tests

Execute tests to ensure they pass:

Run all updated tests:

bash
# Maven
mvn test -Dtest=CalculatorTest

# Gradle
./gradlew test --tests CalculatorTest

Analyze test results:

  • All tests should pass (green)
  • No test failures
  • No test errors
  • Check test output for warnings

If tests fail:

  1. Read failure message and stack trace
  2. Identify the cause (assertion failure, exception, etc.)
  3. Fix the test code or identify issues in production code
  4. Re-run tests
  5. Repeat until all tests pass
10. Validate Test Quality

Ensure updated tests maintain quality standards:

Check test coverage:

  • New code paths are tested
  • Edge cases are covered
  • Exception handling is tested

Verify test independence:

  • Tests don't depend on execution order
  • Each test can run in isolation
  • No shared mutable state between tests

Review test clarity:

  • Test names are descriptive
  • Test logic is clear
  • Assertions are meaningful

Update Patterns

Pattern 1: Signature Change with Added Parameter

Old code:

java
public String formatName(String firstName, String lastName) {
    return firstName + " " + lastName;
}

New code:

java
public String formatName(String firstName, String lastName, String title) {
    return title + " " + firstName + " " + lastName;
}

Old test:

java
@Test
public void testFormatName() {
    String result = formatter.formatName("John", "Doe");
    assertEquals("John Doe", result);
}

Updated test:

java
@Test
public void testFormatName() {
    String result = formatter.formatName("John", "Doe", "Mr.");
    assertEquals("Mr. John Doe", result);
}

@Test
public void testFormatNameWithEmptyTitle() {
    String result = formatter.formatName("John", "Doe", "");
    assertEquals(" John Doe", result);
}
Pattern 2: Method Refactored to Different Class

Old code:

java
public class UserService {
    public boolean validateEmail(String email) {
        return email.contains("@");
    }
}

New code:

java
public class UserService {
    private EmailValidator validator;
    // validateEmail moved to EmailValidator
}

public class EmailValidator {
    public boolean isValid(String email) {
        return email.contains("@");
    }
}

Old test:

java
@Test
public void testValidateEmail() {
    assertTrue(userService.validateEmail("user@example.com"));
}

Updated test:

java
@Mock
private EmailValidator emailValidator;

@BeforeEach
void setUp() {
    userService = new UserService(emailValidator);
}

@Test
public void testEmailValidation() {
    when(emailValidator.isValid("user@example.com")).thenReturn(true);
    // Test userService method that uses emailValidator
}

// Or create separate test for EmailValidator
@Test
public void testEmailValidatorIsValid() {
    EmailValidator validator = new EmailValidator();
    assertTrue(validator.isValid("user@example.com"));
}
Pattern 3: Return Type Changed

Old code:

java
public User findUser(Long id) {
    return repository.findById(id);  // Returns User or null
}

New code:

java
public Optional<User> findUser(Long id) {
    return repository.findById(id);  // Returns Optional<User>
}

Old test:

java
@Test
public void testFindUser() {
    User user = service.findUser(123L);
    assertNotNull(user);
    assertEquals("John", user.getName());
}

Updated test:

java
@Test
public void testFindUser() {
    Optional<User> userOpt = service.findUser(123L);
    assertTrue(userOpt.isPresent());
    assertEquals("John", userOpt.get().getName());
}

@Test
public void testFindUserNotFound() {
    Optional<User> userOpt = service.findUser(999L);
    assertFalse(userOpt.isPresent());
}

Tips

  • Always read both old and new code versions completely
  • Identify all affected test methods before making changes
  • Update one test method at a time
  • Compile frequently to catch errors early
  • Run tests after each update to verify correctness
  • Maintain test coverage - don't remove tests without replacement
  • Add tests for new edge cases introduced by changes
  • Keep test names descriptive and up-to-date
  • Update test documentation/comments if behavior changed
  • Use IDE refactoring tools when available for safe renames

© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/java-test-updater of ArabelaTso/Skills-4-SE.

Open the folder on GitHubat commit 4f38503

Compare with similar skills

Java Test Updater next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Java Test Updater compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Java Test Updater this skillArabelaTso/Skills-4-SE253—~3kAutomated safety check: PassApache-2.0
Java Design Patterns Referencedecebals/claude-code-java7511 repos~4.4kAutomated safety check: PassMIT
Bootui Java Developmentjdubois/boot-ui307—~1.3kAutomated safety check: PassApache-2.0
Goinference-gateway/inference-gateway214—~2.4kAutomated safety check: PassApache-2.0
Java 21 Developer Guide for Grailsapache/grails-core2.9k—~1.9kAutomated safety check: PassApache-2.0
Spring Data Developmentarangodb/spring-data116—~620Automated safety check: PassApache-2.0

Similar skills

  • Java Design Patterns Reference

    decebals/claude-code-java

    A practical Java reference for Builder, Factory, Singleton, Strategy, Observer and other patterns, with a table matching problems to patterns.

    751 GitHub starsUsed in 1 repo~4.4k tokens
    DevelopmentAuto-check passed
  • A skill your agent uses when implementing, debugging, refactoring, or testing existing BootUI Java code, including framework-neutral engine logic, Spring MVC and WebFlux adapters, Quarkus runtime…

    307 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Go

    inference-gateway/inference-gateway

    Idiomatic Go - package and interface design, error wrapping, table-driven tests, generics, the modern standard library (slices/maps/cmp/errors.Join), current syntax, and logging discipline.

    214 GitHub stars~2.4k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Guide for writing modern Java 21 in a Grails and Groovy codebase: records, sealed classes, pattern matching, text blocks and how Java works alongside Groovy.

    2.9k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-check passed
  • Spring Data Development

    arangodb/spring-data

    Maintain and extend the arangodb/spring-data repository. An agent skill from arangodb/spring-data.

    116 GitHub stars~620 tokensUpdated 9 days ago
    DevelopmentAuto-check passed
  • Idea MCP

    dtprj/dongting

    IntelliJ IDEA MCP for Java code analysis, testing, refactoring, and project navigation.

    208 GitHub stars~698 tokensUpdated 3 days ago
    DevelopmentAuto-check passed

More from ArabelaTso/Skills-4-SE

All 150 skills in this repo
  • Framework Migration Assistant

    ArabelaTso/Skills-4-SE

    Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).

    253 GitHub stars~1.9k tokensUpdated 1 mo ago
    Auto-check passed
  • Metamorphic Test Generator

    ArabelaTso/Skills-4-SE

    Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.

    253 GitHub stars~798 tokensUpdated 1 mo ago
    Auto-check passed
  • Reproduction Trace Instrumenter

    ArabelaTso/Skills-4-SE

    Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.

    253 GitHub stars~2.4k tokensUpdated 1 mo ago
    Auto-check passed
  • Spring Mvc To Boot Migrator

    ArabelaTso/Skills-4-SE

    Automatically migrate Spring MVC applications to Spring Boot.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed
  • State Snapshot Instrumenter

    ArabelaTso/Skills-4-SE

    Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.

    253 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check passed

Works with

Categories

Questions about Java Test Updater

What does Java Test Updater do?

Update Java test classes and methods to work with new code versions after refactoring or modifications. Java Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Update Java test classes and methods to work with new code versions after refactoring or modifications.

When should I use Java Test Updater?

Java Test Updater fits situations like: code changes break existing tests due to signature changes; behavior modifications.

How do I install Java Test Updater in Claude Code?

Run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a claude-code`. Or copy the skill folder (skills/java-test-updater in ArabelaTso/Skills-4-SE) into .claude/skills/java-test-updater in your project. Claude Code loads it when a task matches its description.

How do I install Java Test Updater in Codex?

Run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a codex`. Or copy the skill folder (skills/java-test-updater in ArabelaTso/Skills-4-SE) into .agents/skills/java-test-updater in your project. Codex loads it when a task matches its description.

Can I use Java Test Updater in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/java-test-updater, .gemini/skills/java-test-updater, .github/skills/java-test-updater and .opencode/skills/java-test-updater in your project.

What does Java Test Updater need to run?

Going by SKILL.md and its folder, Java Test Updater needs the command-line tools its instructions call (mvn).

Does Java Test Updater access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Java Test Updater safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Java Test Updater use?

Java Test Updater is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Java Test Updater use?

About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Java Test Updater?

Skills that share tags, products or a category with Java Test Updater: Java Design Patterns Reference (decebals/claude-code-java, 751 stars), Bootui Java Development (jdubois/boot-ui, 307 stars), Go (inference-gateway/inference-gateway, 214 stars) and Java 21 Developer Guide for Grails (apache/grails-core, 2.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Java Test Updater?

ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on August 21, 2026.

Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.