This file contains 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
package com.example.AppiumAi; | |
import org.junit.Before; | |
import org.junit.Test; | |
import org.openqa.selenium.remote.DesiredCapabilities; | |
import io.appium.java_client.android.AndroidDriver; | |
import io.appium.java_client.remote.MobileCapabilityType; | |
import io.appium.java_client.remote.MobilePlatform; |
This file contains 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
if numeroDePatas = 4 and revestimento = "pelo" and peso > 5.0 and peso < 8.0 then | |
return "cachorro do mato" | |
if numeroDePatas = 2 and revestimento = "pena" and peso > 1.2 and peso < 1.7 then | |
return "arara" | |
if numeroDePatas = 4 and revestimento = "pelo" and peso > 11.0 and peso < 16.0 then | |
return "gato do mato" |
This file contains 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
package com.montanha.gerenciador.responses; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class Response<T> { | |
private T data; | |
private List<String> errors; |
This file contains 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 GerenciadorViagemController { | |
@Autowired | |
private ViagemServices viagemService; | |
@PostMapping(path = "/new") | |
public ResponseEntity<Response<Viagem>> cadastrar(@Valid @RequestBody ViagemDto viagemDto, BindingResult result) { | |
Response<Viagem> response = new Response<Viagem>(); | |
if (result.hasErrors()) { |
This file contains 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
package com.montanha.gerenciador.repositories; | |
import org.springframework.data.jpa.repository.JpaRepository; | |
import org.springframework.stereotype.Repository; | |
import com.montanha.gerenciador.entities.Viagem; | |
@Repository | |
public interface ViagemRepository extends JpaRepository<Viagem, Long> { | |
Viagem findByLocalDeDestino(String localDeDestino); |
This file contains 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
package com.montanha.gerenciador.dtos; | |
import java.io.Serializable; | |
import java.util.Date; | |
import javax.validation.constraints.NotNull; | |
import org.hibernate.validator.constraints.Length; | |
import com.fasterxml.jackson.annotation.JsonFormat; | |
public class ViagemDto implements Serializable { |
This file contains 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
package com.montanha.gerenciador.services; | |
import java.util.List; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.stereotype.Service; | |
import com.montanha.gerenciador.dtos.ViagemDto; | |
import com.montanha.gerenciador.entities.Viagem; | |
import com.montanha.gerenciador.repositories.ViagemRepository; | |
import com.montanha.gerenciador.services.exceptions.ViagemServiceException; |
This file contains 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
@Autowired | |
private ViagemServices viagemService; | |
@PostMapping(path = "/new") | |
public ResponseEntity<Response<Viagem>> cadastrar(@Valid @RequestBody ViagemDto viagemDto, BindingResult result) { | |
Response<Viagem> response = new Response<Viagem>(); | |
if (result.hasErrors()) { | |
result.getAllErrors().forEach(error -> response.getErrors().add(error.getDefaultMessage())); | |
return ResponseEntity.badRequest().body(response); |
This file contains 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
package com.montanha.gerenciador.controller; | |
import java.net.URI; | |
import java.util.List; | |
import javax.validation.Valid; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.http.HttpStatus; | |
import org.springframework.http.ResponseEntity; | |
import org.springframework.validation.BindingResult; | |
import org.springframework.web.bind.annotation.GetMapping; |
This file contains 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
package com.montanha.gerenciador.entities; | |
import java.io.Serializable; | |
import java.util.Date; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.GeneratedValue; | |
import javax.persistence.GenerationType; | |
import javax.persistence.Id; | |
import javax.persistence.Table; | |
import org.springframework.stereotype.Component; |
NewerOlder