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) { }
        }
    }
}
