This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DolarConverterService { | |
public Double covertToDolar(DolarPojo dolar,Double value) { | |
return value/dolar.getDolarValue(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DolarConverterServiceTest { | |
@Test //Anotacion | |
void result_one_when_value_is_equals_dolar() { | |
//1. Preparación | |
DolarService dolarService = Mockito.mock(DolarService.class); | |
Mockito.when(dolarService.getDolarValue(DivisasEnum.MXN)).thenReturn(new DolarPojo(19.3,new Date())); | |
//2. Ejecución |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DolarConverterService { | |
public Double covertToDolar(DolarPojo dolar,Double value) { | |
return null; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum DivisasEnum { | |
MXN,CAD,EURO | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DolarPojo { | |
Double dolarValue; | |
Date date; | |
public DolarPojo() { | |
super(); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependencies> | |
<dependency> | |
<groupId>org.junit.jupiter</groupId> | |
<artifactId>junit-jupiter-api</artifactId> | |
<version>5.7.1</version> | |
<scope>test</scope> | |
</dependency> | |
<dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
insert into tasks (description,status,creation_date)values('buy cereal',0, NOW()); | |
insert into tasks (description,status,creation_date)values('study math',0, NOW()); | |
insert into tasks (description,status,creation_date)values('save money',1, NOW()); | |
insert into tasks (description,status,creation_date)values('buy apples',0, NOW()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RestController | |
@RequestMapping (value="todolist") | |
public class ToDoList { | |
@Autowired | |
private ITaskService taskService; | |
@GetMapping(value="tasks") | |
public List<Task> getTasks() { | |
return taskService.getTask(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ITaskService { | |
public List<Task> getTask(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface ITaskDao extends CrudRepository<Task, Long> { | |
} |
NewerOlder