Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Alvaro Ordóñez Romero
/
DAE-aha00026-aor00039
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
afa7ba1f
authored
Dec 09, 2023
by
Alvaro Ordóñez Romero
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Corregido el funcionamiento del test de ControladorRESTTEST
parent
2134592e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
11 deletions
src/main/java/com/carpooling/carpoolingaoraha/entidades/Usuario.java
src/main/java/com/carpooling/carpoolingaoraha/rest/dto/DTOUsuario.java
src/test/java/com/carpooling/carpoolingaoraha/ControladorRESTEST/ControladorRESTTEST.java
src/main/java/com/carpooling/carpoolingaoraha/entidades/Usuario.java
View file @
afa7ba1f
...
@@ -98,6 +98,23 @@ public class Usuario {
...
@@ -98,6 +98,23 @@ public class Usuario {
this
.
sistemaCarPooling
=
sis
;
this
.
sistemaCarPooling
=
sis
;
}
}
public
Usuario
(
String
nombre
,
String
apellidos
,
Date
FNac
,
String
DNI
,
int
telefono
,
String
email
,
String
claveAcceso
,
Rol
rol
)
{
this
.
nombre
=
nombre
;
this
.
apellidos
=
apellidos
;
this
.
FNac
=
FNac
;
this
.
DNI
=
DNI
;
this
.
telefono
=
telefono
;
this
.
email
=
email
;
this
.
claveAcceso
=
claveAcceso
;
this
.
puntuacion
=
new
ArrayList
<>();
this
.
rol
=
rol
;
this
.
viajesOfertados
=
new
ArrayList
<>();
this
.
solicitudesPendientes
=
new
ArrayList
<>();
this
.
historicoSolicitudes
=
new
ArrayList
<>();
this
.
puntuacionMedia
=
0
;
}
public
void
setSistemaCarPooling
(
SistemaCarPooling
sis
){
this
.
sistemaCarPooling
=
sis
;}
public
void
setSistemaCarPooling
(
SistemaCarPooling
sis
){
this
.
sistemaCarPooling
=
sis
;}
public
String
getNombre
()
{
public
String
getNombre
()
{
...
...
src/main/java/com/carpooling/carpoolingaoraha/rest/dto/DTOUsuario.java
View file @
afa7ba1f
...
@@ -8,14 +8,14 @@ import java.util.Date;
...
@@ -8,14 +8,14 @@ import java.util.Date;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Objects
;
public
record
DTOUsuario
(
String
nombre
,
String
apellidos
,
Date
FNac
,
String
DNI
,
int
telefono
,
String
email
,
String
claveAcceso
,
Usuario
.
Rol
rol
,
double
puntuacionMedia
,
List
<
Solicitud
>
solicitudesPendientes
,
List
<
Solicitud
>
historicoSolicitudes
,
SistemaCarPooling
sistemaCarPooling
){
public
record
DTOUsuario
(
String
nombre
,
String
apellidos
,
Date
FNac
,
String
DNI
,
int
telefono
,
String
email
,
String
claveAcceso
,
Usuario
.
Rol
rol
){
public
DTOUsuario
(
Usuario
usuario
)
{
public
DTOUsuario
(
Usuario
usuario
)
{
this
(
usuario
.
getNombre
(),
usuario
.
getApellidos
(),
usuario
.
getFNac
(),
usuario
.
getDNI
(),
usuario
.
getTelefono
(),
usuario
.
getEmail
(),
usuario
.
getClaveAcceso
(),
usuario
.
getRol
()
,
usuario
.
getPuntuacionMedia
(),
usuario
.
getSolicitudesPendientes
(),
usuario
.
getHistoricoSolicitudes
(),
usuario
.
getSistemaCarPooling
()
);
this
(
usuario
.
getNombre
(),
usuario
.
getApellidos
(),
usuario
.
getFNac
(),
usuario
.
getDNI
(),
usuario
.
getTelefono
(),
usuario
.
getEmail
(),
usuario
.
getClaveAcceso
(),
usuario
.
getRol
());
}
}
public
Usuario
altaUsuario
(){
public
Usuario
altaUsuario
(){
return
new
Usuario
(
nombre
,
apellidos
,
FNac
,
DNI
,
telefono
,
email
,
claveAcceso
,
rol
,
sistemaCarPooling
);
return
new
Usuario
(
nombre
,
apellidos
,
FNac
,
DNI
,
telefono
,
email
,
claveAcceso
,
rol
);
}
}
@Override
@Override
...
@@ -23,12 +23,12 @@ public record DTOUsuario (String nombre, String apellidos, Date FNac, String DNI
...
@@ -23,12 +23,12 @@ public record DTOUsuario (String nombre, String apellidos, Date FNac, String DNI
if
(
this
==
o
)
return
true
;
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
DTOUsuario
that
=
(
DTOUsuario
)
o
;
DTOUsuario
that
=
(
DTOUsuario
)
o
;
return
telefono
==
that
.
telefono
&&
Double
.
compare
(
that
.
puntuacionMedia
,
puntuacionMedia
)
==
0
&&
Objects
.
equals
(
nombre
,
that
.
nombre
)
&&
Objects
.
equals
(
apellidos
,
that
.
apellidos
)
&&
Objects
.
equals
(
FNac
,
that
.
FNac
)
&&
Objects
.
equals
(
DNI
,
that
.
DNI
)
&&
Objects
.
equals
(
email
,
that
.
email
)
&&
Objects
.
equals
(
claveAcceso
,
that
.
claveAcceso
)
&&
rol
==
that
.
rol
&&
Objects
.
equals
(
solicitudesPendientes
,
that
.
solicitudesPendientes
)
&&
Objects
.
equals
(
historicoSolicitudes
,
that
.
historicoSolicitudes
)
&&
Objects
.
equals
(
sistemaCarPooling
,
that
.
sistemaCarPooling
)
;
return
telefono
==
that
.
telefono
&&
Objects
.
equals
(
nombre
,
that
.
nombre
)
&&
Objects
.
equals
(
apellidos
,
that
.
apellidos
)
&&
Objects
.
equals
(
FNac
,
that
.
FNac
)
&&
Objects
.
equals
(
DNI
,
that
.
DNI
)
&&
Objects
.
equals
(
email
,
that
.
email
)
&&
Objects
.
equals
(
claveAcceso
,
that
.
claveAcceso
)
&&
rol
==
that
.
rol
;
}
}
@Override
@Override
public
int
hashCode
()
{
public
int
hashCode
()
{
return
Objects
.
hash
(
nombre
,
apellidos
,
FNac
,
DNI
,
telefono
,
email
,
claveAcceso
,
rol
,
puntuacionMedia
,
solicitudesPendientes
);
return
Objects
.
hash
(
nombre
,
apellidos
,
FNac
,
DNI
,
telefono
,
email
,
claveAcceso
,
rol
);
}
}
@Override
@Override
...
@@ -42,8 +42,6 @@ public record DTOUsuario (String nombre, String apellidos, Date FNac, String DNI
...
@@ -42,8 +42,6 @@ public record DTOUsuario (String nombre, String apellidos, Date FNac, String DNI
", email='"
+
email
+
'\''
+
", email='"
+
email
+
'\''
+
", claveAcceso='"
+
claveAcceso
+
'\''
+
", claveAcceso='"
+
claveAcceso
+
'\''
+
", rol="
+
rol
+
", rol="
+
rol
+
", puntuacionMedia="
+
puntuacionMedia
+
", solicitudesPendientes="
+
solicitudesPendientes
+
'}'
;
'}'
;
}
}
}
}
src/test/java/com/carpooling/carpoolingaoraha/ControladorRESTEST/ControladorRESTTEST.java
View file @
afa7ba1f
...
@@ -47,11 +47,8 @@ public class ControladorRESTTEST {
...
@@ -47,11 +47,8 @@ public class ControladorRESTTEST {
}
}
@Test
@Test
public
void
altaUsuario
(){
public
void
altaUsuario
(){
List
<
Solicitud
>
solicitudList
=
new
ArrayList
<>();
List
<
Solicitud
>
historico
=
new
ArrayList
<>();
SistemaCarPooling
sis
=
new
SistemaCarPooling
();
Date
fecha
=
new
Date
(
2000
,
12
,
1
);
Date
fecha
=
new
Date
(
2000
,
12
,
1
);
DTOUsuario
usuario
=
new
DTOUsuario
(
"Fernando"
,
"Alonso D
íaz"
,
fecha
,
"11995667D"
,
988674533
,
"hola@gmail.com"
,
"1234"
,
Usuario
.
Rol
.
CONDUCTOR
,
0
,
solicitudList
,
historico
,
sis
);
DTOUsuario
usuario
=
new
DTOUsuario
(
"Fernando"
,
"Alonso D
iaz"
,
fecha
,
"78162640S"
,
670988953
,
"hola@gmail.com"
,
"1234"
,
Usuario
.
Rol
.
CONDUCTOR
);
ResponseEntity
<
DTOUsuario
>
respuesta
=
restTemplate
.
postForEntity
ResponseEntity
<
DTOUsuario
>
respuesta
=
restTemplate
.
postForEntity
(
(
"/usuarios"
,
usuario
,
DTOUsuario
.
class
"/usuarios"
,
usuario
,
DTOUsuario
.
class
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment