-
Notifications
You must be signed in to change notification settings - Fork 676
Expand file tree
/
Copy pathVetControllerTest.java
More file actions
49 lines (36 loc) · 1.4 KB
/
VetControllerTest.java
File metadata and controls
49 lines (36 loc) · 1.4 KB
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
package guru.springframework.sfgpetclinic.controllers;
import static org.junit.jupiter.api.Assertions.*;
import guru.springframework.sfgpetclinic.fauxspring.Model;
import guru.springframework.sfgpetclinic.model.Vet;
import guru.springframework.sfgpetclinic.services.SpecialtyService;
import guru.springframework.sfgpetclinic.services.VetService;
import guru.springframework.sfgpetclinic.services.map.SpecialityMapService;
import guru.springframework.sfgpetclinic.services.map.VetMapService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.util.Set;
import static org.junit.jupiter.api.Assertions.*;
class VetControllerTest {
VetController controller;
Model model;
VetService service;
SpecialtyService specialtyService;
@BeforeEach
void setUp() {
specialtyService = new SpecialityMapService();
service = new VetMapService(specialtyService);
controller = new VetController(service);
model = new ModelImpl();
Vet vet1 = new Vet(10l, "Mac", "Kem", null);
Vet vet2 = new Vet(11l, "Radzio", "Bluszcz", null);
service.save(vet1);
service.save(vet2);
}
@Test
void listVets() {
String str = controller.listVets(model);
assertEquals("vets/index", str);
Set vets = (Set)((ModelImpl)model).getMap().get("vets");
assertEquals(vets.size(),2);
}
}