# Mocks to the rescue The classes `SSLSocket`, `TLSProtocol` and `TLSSocketFactory` are included in the `sockets` package of the [`tp3-ssl`](../code/tp3-ssl) project. The test class `TLSSocketFactoryTest` tests `TLSSocketFactory` and manually builds stubs and mocks for SSLSocket objects. Rewrite these tests with the help of Mockito. The initial tests fail to completely test the `TLSSockeetFactory`. In fact, if we *entirely* remove the code inside the body of `prepareSocket` no test case fails. Propose a solution to this problem in your new Mockito-based test cases. Aucun test n'échoue quand on supprime le contenu de prepareSocket() car les tests ne vérifient les conditions seulement si setEnabledProtocols se lance, or si prepareSocket() est vide setEnabledProtocols n'est jamais appelé, donc ni le fail(), ni le assertTrue() n'est exécuté. Le test passe donc. Avec les Mock, on utilise verify. Si setEnabledProtocols n'est jamais appelé, alors c'est aussi une erreur