Java, Unit Testing, Tdd, Programming, Technology.
Make the private method accessible method.setAccessible(true); // Invoke the private method String result = (String) method.invoke(myClass, "test"); System.out.println("Result: " + result); } catch (Exception e) { e.printStackTrace(); } } } class MyClass { private String privateMethod(String input)