Bonjour,

débutant dans les tests unitaires, je souhaite écrire le test de cette méthode :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
    /**
     * @param societyCode
     * @param societeRefDataMap
     * @return Le nom AD si il existe
     * @throws ReportPtgFileException
     */
    public String findNomADSocietyByCode(String societyCode, Map<Integer, SocieteRefData> societeRefDataMap)
        throws ReportPtgFileException {
        Integer societyCodeInteger = Integer.parseInt(societyCode);
        return Optional.ofNullable(societeRefDataMap.get(societyCodeInteger)).map(SocieteRefData::getNomAd)
            .orElseThrow(() -> ReportPtgFileException.build(Constants.PRH_ERROR_CODE_REJET)
                .withMessage(MessageConstants.REJ_CODE_SOCIETE, societyCode));
    }
Je souhaiterais écrire le test en utilisant l'écriture Given/When/Then.

Merci pour votre aide.

Cdt,