Skip to content

Commit 98fcb67

Browse files
author
alaansb
committed
- Remove unit tests for the candidate to implement them
- Remove PlaceController autowired - Implement README
1 parent 5edc2f9 commit 98fcb67

File tree

3 files changed

+16
-48
lines changed

3 files changed

+16
-48
lines changed

README.md

+16-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,21 @@
1-
# Clickbus Live Coding Challenge
1+
# Backend Developer Challenge
22

3+
Esse desafio serve para avaliarmos suas habilidades em construir APIs.
34

4-
## Dependencies
5+
# Instruções e requisitos
6+
Implementar alguns requisitos faltantes na API de places da Clickbus.
57

6-
This project is built using:
8+
- Clonar o repositorio
9+
- Criar uma branch
10+
- Completar as implementações faltantes, para que os testes passem
11+
- Implementar testes unitarios para a funcionalidade `PlaceService.findAll`
12+
- Executar testes manuais
13+
- Abrir um PR para a master
714

8-
- Java 8
9-
- Spring Boot
10-
- Spring Data
11-
- Lombok
12-
- Swagger
13-
- Junit 5 - H2 to repository tests
14-
- H2 DataBase
15+
# Recomendações
16+
- SOLID
17+
- Código e commits em english (métodos, classes e variáveis)
1518

16-
## Test End-Points
17-
18-
- Create:
19-
```curl -X POST http://localhost:8080/place -H 'Content-Type: application/json' -d '{ "name": "Butanta", "slug": "bt", "state": "SP", "city": "Sao Paulo" }'```
20-
21-
- Edit:
22-
```curl -X PUT http://localhost:8080/place/1 -H 'Content-Type: application/json' -d '{ "name": "Cotia", "slug": "bt", "state": "SP", "city": "Sao Paulo" }'```
23-
24-
- Find all:
25-
```curl -X GET http://localhost:8080/place```
26-
27-
- Find by name:
28-
```curl -X GET http://localhost:8080/place/?name={name}```
29-
30-
- Find by id:
31-
```curl -X GET http://localhost:8080/place/{id}```
19+
# Critérios de avaliação
20+
- Boas práticas de programação
21+
- Práticas de VCS

src/main/java/br/com/clickbus/challenge/controller/PlaceController.java

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
@RequestMapping("places")
2525
public class PlaceController {
2626

27-
@Autowired
2827
private PlaceService service;
2928

3029
@PostMapping

src/test/java/br/com/clickbus/challenge/service/PlaceServiceTest.java

-21
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,6 @@ void setUp() {
4545
place = Place.of(NAME_PLACE, "bt", "Sao Paulo", "SP");
4646
}
4747

48-
@Test
49-
void whenFindAllThenReturnPlaces() {
50-
when(repository.findAll()).thenReturn(Collections.singletonList(place));
51-
52-
List<Place> placesFound = service.findAll();
53-
54-
assertEquals(1, placesFound.size());
55-
assertEquals(NAME_PLACE, placesFound.get(0).getName());
56-
verify(repository, atLeastOnce()).findAll();
57-
}
58-
59-
@Test
60-
void whenFindAllReturnListEmpty() {
61-
when(repository.findAll()).thenReturn(new ArrayList<>());
62-
63-
List<Place> places = service.findAll();
64-
65-
assertTrue(places.isEmpty());
66-
verify(repository, atLeastOnce()).findAll();
67-
}
68-
6948
@Test
7049
void whenFindByIdOk() {
7150
when(repository.findById(1L)).thenReturn(Optional.of(place));

0 commit comments

Comments
 (0)