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?