You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let's assume I have a field named "password", but it is labeled as "pwd" in the toString() method. I would expect that the following test should fail, but it passes. Maybe this could be fixed by failing if the test contains any unexpected fields? (I did not find an option for this.)
import org.junit.Test;
import com.jparams.verifier.tostring.NameStyle;
import com.jparams.verifier.tostring.ToStringVerifier;
public class PasswordWithWrongFieldLabelShouldThrowTest
{
private static class ClassWithPassword
{
private String password;
@Override
public String toString()
{
return "ClassWithPassword{" + "pwd=" + password + '}';
}
}
@Test
public void testToString() {
ToStringVerifier.forClass(ClassWithPassword.class)
.withClassName(NameStyle.SIMPLE_NAME)
.withIgnoredFields("password")
.withFailOnExcludedFields(true)
.verify();
}
}
The text was updated successfully, but these errors were encountered:
Let's assume I have a field named "password", but it is labeled as "pwd" in the toString() method. I would expect that the following test should fail, but it passes. Maybe this could be fixed by failing if the test contains any unexpected fields? (I did not find an option for this.)
The text was updated successfully, but these errors were encountered: