Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import interfacemanualmocking.AuthenticationByBiometryService;
import interfacemanualmocking.AuthenticationByPasswordService;
import interfacemanualmocking.MockDirectory;
import interfacemanualmocking.MockStrengthEstimationService;
import org.junit.jupiter.api.*;
import static authentication.Strength.*;
import static authentication.Strength.STRONG;
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
public class AuthenticationByBiometryServiceTest {
private MockDirectory directory;
private AuthenticationByBiometryService authenticationByBiometryService;
@BeforeAll
static void setUpBeforeClass() throws Exception {
System.out.println("Before all");
}
@AfterAll
static void tearDownAfterClass() throws Exception {
System.out.println("After all");
}
@BeforeEach
void setUp() {
directory = new MockDirectory();
authenticationByBiometryService = new AuthenticationByBiometryService(directory, STRONG);
authenticationByBiometryService.setDirectory(directory);
}
@AfterEach
void tearDown() throws Exception {
System.out.println("After each");
}
@Test
void testIsAMatch() {
assertThat(authenticationByBiometryService.isAMatch("regix", "azerty")).isTrue();
}
@Test
void testDataStrenth() {
assertThat(authenticationByBiometryService.dataStrenth("azerty")).isEqualTo(STRONG);
assertThat(authenticationByBiometryService.dataStrenth("azertyuiopqsdfghjklmwxcvbn1234567890")).isEqualTo(STRONG);
}
}