DEV Community

Harit Himanshu
Harit Himanshu

Posted on

How do I test if a private method has a field with a name and a type?

Here is the private method I am trying to test

    private int privateMethod(int[] numbers) {
        var sum = 0;
        for (int number : numbers) {
            sum += number;
        }
        return sum;
    }

I am doing this in Java 11

And following is my test using Junit5

import org.junit.jupiter.api.Test;
import org.junit.platform.commons.function.Try;

Top comments (1)

Collapse
 
alainvanhout profile image
Alain Van Hout

What would be the purpose of such a test?

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more