Softwaretechnik-II/testing/AufgabeUserRegistration/UserRegistrationFuzzTest.java

21 lines
829 B
Java
Raw Permalink Normal View History

2024-10-30 19:29:50 +01:00
import com.code_intelligence.jazzer.api.FuzzedDataProvider;
import com.code_intelligence.jazzer.junit.FuzzTest;
import java.security.InvalidParameterException;
public class UserRegistrationFuzzTest {
@FuzzTest
public static void fuzzerTestOneInput(FuzzedDataProvider data) {
String email = data.consumeString(100);
if(EmailMatcher.isValidEmail(email)) {
String user = data.consumeString(100);
String password = data.consumeString(100);
try {
UserRegistration.registerUser(user, password, email);
System.out.println("User: " + user + ", Password: " + password + ", Email: " + email);
throw new InvalidParameterException("This registration is valid!");
} catch (RegistrationException e) { }
}
}
}