Do you consider useful a Java tool that records JUnit and Mockito unit/integration tests from runtime calls?

I know TDD is the way, but there might be cases when generating tests from existing code could be useful:

  • when you need to maintain code that does not have unit tests
  • when, for some reason, in your company there is no time/budget/culture/wiliness to do TDD, but having generated tests is still better than having no tests
  • when the tests and mocks are long and hard to write and you could use a jumpstart
  • when you are doing big changes in the design and a lot of the tests need to be rewritten
  • when you want to record a functional test with real users data

I imagine this tool would work like this:

  1. You mark a method with an @RecordTest annotation.
  2. You mark some injected dependencies with @RecordMockForTest annotation.
  3. You run the project and interact with UI/API.
  4. Context, arguments and results are retrieved using AOP and reflection and used to generate a test file on disk for each function call.

Example: Let’s say you have some function for calculating Employee salary that does not have automated tests yet.

public class SalaryService {
    public double computeEmployeeSalary(int employeeId) throws Exception {
        // ...
        Employee employee = employeeRepository.getEmployee(employeeId);
        // ...
        return salary;

public class EmployeeRepository {
    public Employee getEmployee(int id) throws Exception {
        // ...
        // Get Employee from DB
        // ...
        return employee;

You add @RecordTest to computeEmployeeSalary function to mark that you want tests generated from the calls to this function.

You add @RecordMockForTest to EmployeeRepository class to mark that you want this class mocked in the tests.

The resulted test will be:

import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.*;
import com.sampleapp.model.Department;
import com.sampleapp.model.Employee;
import static org.mockito.Mockito.*;

class SalaryServiceTest {
    void computeEmployeeSalary() throws Exception {
        // Arrange
        Department department1 = Department.builder()
        Employee employee1 = Employee.builder()
        EmployeeRepository employeeRepository = mock(EmployeeRepository.class);
        SalaryService salaryService = new SalaryService(employeeRepository);

        // Act
        double result = salaryService.computeEmployeeSalary(1);

        // Assert
        assertEquals(4000.0, result);

I am thinking to write an open source tool for this. It would be very helpful for me to hear more opinions before investing effort in a direction that might not be so useful.

migration – what is the best way to migrate data from one sharepoint online library to another sharepoint online library within the same site collection. Any tool

Your privacy

By clicking “Accept all cookies”, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy.

untagged – Which tool for UX design should I choose?

untagged – Which tool for UX design should I choose? – User Experience Stack Exchange

linux – Simulate some process IO with fio or other tool

Is there any way to track specific process and get stats for disk IO such as queue death, total reading/writing threads, percent of reads/writes and so on?

Main goal is to use all that information to emulate IO activity with fio tool.
Or maybe any other way (tool) to estimate which hardware can be better for specific load?

Of course testing is the best option, but not fully available for me, I cannot buy all possible hardware.
So I have to compare with one which I already have to make some assumptions before buying.

Looking for a tool to create a special quiz

Hello y'all!

My team is searching a tool or a website to replace a test that we usually do on paper or in Excel. We have tried Survey Monkey, Microsoft forms and others, but there is always an important missing part. We need a tool or software that can:

  • Offers the possibility, for every question, to rank 4 answers in order of preference. The scores need to be 8, 4, 2 and 1. Example below

View attachment 264344

  • Calculates the total of each of the four…

Looking for a tool to create a special quiz

lenovo – Advice on setting up cross compilation tool chain for Android 10 SDK29+?

I have a simple ‘helloworld.c” that I want to run from ADB shell then eventually create an app that can display it on my device.
Im quite new to C, Linux, Android, cross compiling, libraries in terms of real world results but Iv been doing a hell of a lot of reading and am getting used to my Linux (full install). I realise following various tutorials can be misleading due to the fact of outdated software / differnet hardware as I am attempting the above challenge on a relatively new device with relatively new hardware “android 10 R”. I could just do with some ‘best practice’ advice on choosing the correct libraries and tool chain setup.

I understand making the ‘helloworld’ as an app is more complicated requiring use of Android NDK, so first step is to get it working within ADB shell.

Device – Lenovo M8 FHD android 10 R


armv8l ( returned from ADBShell> uname -m )


Installed libraries –

ii g++ 4:9.3.0-1ubuntu2 amd64 GNU C++ compiler

ii g++-9 9.3.0-17ubuntu1~20.04 amd64 GNU C++ compiler

ii gcc 4:9.3.0-1ubuntu2 amd64 GNU C compiler
ii gcc-9 9.3.0-17ubuntu1~20.04 amd64 GNU C compiler

ii gcc-9-aarch64-linux-gnu 9.3.0-17ubuntu1~20.04cross2 amd64 GNU C compiler (cross compiler for arm64 architecture)

ii gcc-9-arm-linux-gnueabi 9.3.0-17ubuntu1~20.04cross2 amd64 GNU C compiler (cross compiler for armel architecture)

ii gcc-aarch64-linux-gnu 4:9.3.0-1ubuntu2 amd64 GNU C compiler for the arm64 architecture

ii gcc-arm-linux-gnueabi 4:9.3.0-1ubuntu2 amd64 GNU C compiler for the armel architecture

ii libllvm10:amd64 1:10.0.0-4ubuntu1 amd64 Modular compiler and toolchain technologies, runtime library

ii libllvm11:amd64 1:11.0.0-2~ubuntu20.04.1 amd64 Modular compiler and toolchain technologies, runtime library

ii libllvm11:i386 1:11.0.0-2~ubuntu20.04.1 i386 Modular compiler and toolchain technologies, runtime library

ii libxkbcommon0:amd64 0.10.0-1 amd64 library interface to the XKB compiler – shared library

ii libxkbcommon0:i386 0.10.0-1 i386 library interface to the XKB compiler – shared library

Firstly is the aarch64 above the correct cross compiler for my device?
Any clarification on how to make sure I have JUST the tools I need for getting helloworld in shell including relevent versions that work with SDK29 ?

So far when I try to run my cross compiler helloworld.c from shell I get – file not found error.
I have googled for many answers on this error and believe its a compilation error, so now Im just lost in libraries! and what did I do wrong. I think the tutorial I used has mislead me to wrong cross compiler choice, I don’t know?

ps I will try and clean this question up.
also I understand LLVM could help my problem but is this still experimental ?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123