package com.sopra.bbl.msa.profile.controller;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.sopra.bbl.msa.profile.service.ProfileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Random;
import java.util.Set;

/**
 * Controller gérant les adresses mails des profils
 *
 * @author jntakpe
 */
@RestController
@RequestMapping("mails")
public class MailController {

    private final ProfileService profileService;

    @Autowired
    public MailController(ProfileService profileService) {
        this.profileService = profileService;
    }

    @HystrixCommand
    @RequestMapping(method = RequestMethod.GET)
    public Set<String> findMailsWithLogins(@RequestParam Set<String> logins) {
        if (new Random().nextInt(4) + 1 < 4) {
            throw new IllegalStateException("Random error");
        }
        return profileService.findMailsWithLogins(logins);
    }
}

@@ -485,33 +485,8 @@
 r;%0A%0A
-import java.util.Random;%0A
 impo
@@ -986,126 +986,8 @@
 ) %7B%0A
-        if (new Random().nextInt(4) + 1 %3C 4) %7B%0A            throw new IllegalStateException(%22Random error%22);%0A        %7D%0A
     

Fix random fail