
com.cedarsoft.TestUtils Maven / Gradle / Ivy
package com.cedarsoft;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
/**
*
*/
public class TestUtils {
private TestUtils() {
}
/**
* Cleans up all fields within a given test
*
* @param test the test that is cleaned up
*/
public static void cleanupFields( Object test ) throws IllegalAccessException {
if ( test == null ) {
return;
}
for ( Field field : test.getClass().getDeclaredFields() ) {
if ( Modifier.isFinal( field.getModifiers() ) ) {
continue;
}
field.setAccessible( true );
field.set( test, null );
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy