Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
Entrega_javcalv_victorm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
javcalv
Entrega_javcalv_victorm
Commits
a7bd56df
Commit
a7bd56df
authored
5 months ago
by
Javier Calvo
Browse files
Options
Downloads
Patches
Plain Diff
PackCamionBarcoTest realizado
parent
cd6d5d22
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/es/markse/PackCamionBarco.java
+2
-2
2 additions, 2 deletions
src/es/markse/PackCamionBarco.java
src/es/markse/PackCamionTren.java
+2
-1
2 additions, 1 deletion
src/es/markse/PackCamionTren.java
uses/es/markse/PackCamionBarcoTest.java
+138
-6
138 additions, 6 deletions
uses/es/markse/PackCamionBarcoTest.java
with
142 additions
and
9 deletions
src/es/markse/PackCamionBarco.java
+
2
−
2
View file @
a7bd56df
...
...
@@ -35,7 +35,7 @@ public class PackCamionBarco extends Combinado {
throw
new
IllegalArgumentException
(
"Los trayectos en camion estan vacios"
);
//Comprobamos si las clases son solo de tipo Camion o Tren
if
(
trayectosCorrectos
(
trayectosSimples
))
if
(
!
trayectosCorrectos
(
trayectosSimples
))
throw
new
IllegalArgumentException
(
"Las clases agregadas al ArrayList son invalidas"
);
//Comprobar si hay un trayecto de barco y de camion al menos (Obligatorio por nuestra parte)
...
...
@@ -49,8 +49,8 @@ public class PackCamionBarco extends Combinado {
throw
new
IllegalArgumentException
(
"El orden de los trayectos no es correcto. "
+
"Comprueba si el destino es el mismo que el origen del siguiente trayecto"
);
compararTrayectosDeLaLista
(
trayectosSimples
);
this
.
trayectosSimples
=
trayectosSimples
;
compararTrayectosDeLaLista
(
trayectosSimples
);
}
...
...
This diff is collapsed.
Click to expand it.
src/es/markse/PackCamionTren.java
+
2
−
1
View file @
a7bd56df
...
...
@@ -53,8 +53,9 @@ public class PackCamionTren extends Combinado {
throw
new
IllegalArgumentException
(
"El orden de los trayectos no es correcto. "
+
"Comprueba si el destino es el mismo que el origen del siguiente trayecto"
);
compararTrayectosDeLaLista
(
trayectosSimples
);
this
.
trayectosSimples
=
trayectosSimples
;
compararTrayectosDeLaLista
(
trayectosSimples
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
uses/es/markse/PackCamionBarcoTest.java
+
138
−
6
View file @
a7bd56df
...
...
@@ -19,23 +19,155 @@ public class PackCamionBarcoTest {
@Test
public
void
testPackCamionBarco
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
tru
e
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
tru
e
);
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
fals
e
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
fals
e
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayLis
PackCamionBarco
pcb
=
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
)
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"03"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TCamion
tc
=
new
TCamion
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TBarco
tb
=
new
TBarco
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tc
);
trayectosSimples
.
add
(
tb
);
PackCamionBarco
pcb
=
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
assertEquals
(
pcb
.
getMuelleOrigen
().
getIdentificador
(),
"01"
);
assertEquals
(
pcb
.
getPuertoDestino
().
identificadorPuerto
(),
"ES-VAL"
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testPackCamionBarcoTrayectosNulos
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testPackCamionBarcoTrayectosIncorrectos
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TCamion
tc
=
new
TCamion
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TTren
tb
=
new
TTren
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tc
);
trayectosSimples
.
add
(
tb
);
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testPackCamionBarcosSinTrayectosCamion
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TBarco
tc
=
new
TBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TBarco
tb
=
new
TBarco
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tc
);
trayectosSimples
.
add
(
tb
);
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testPackCamionBarcoSinTrayectosBarco
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TCamion
tc
=
new
TCamion
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TCamion
tb
=
new
TCamion
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tc
);
trayectosSimples
.
add
(
tb
);
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
void
testPackCamionBarcoOrdenTrayectosIncorrecto
()
{
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TCamion
tc
=
new
TCamion
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TBarco
tb
=
new
TBarco
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tb
);
trayectosSimples
.
add
(
tc
);
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
}
@Test
public
void
testCosteTrayecto
()
{
fail
(
"Not yet implemented"
);
Muelle
muelleOrigen
=
new
Muelle
(
"01"
,
new
GPSCoordinate
(
10.0
,
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Muelle
muelleDestino
=
new
Muelle
(
"02"
,
new
GPSCoordinate
(
15.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoOrigen
=
new
Puerto
(
"ES"
,
"BAR"
);
Puerto
puertoDestino
=
new
Puerto
(
"ES"
,
"VAL"
);
puertoOrigen
.
anyadirMuelle
(
muelleOrigen
);
puertoDestino
.
anyadirMuelle
(
muelleDestino
);
Fecha
fechaInicioTrayecto
=
new
Fecha
(
20
,
10
,
2015
);
Fecha
fechaFinTrayecto
=
new
Fecha
(
30
,
10
,
2015
);
ArrayList
<
Simple
>
trayectosSimples
=
new
ArrayList
<>();
Muelle
muelleConexion
=
new
Muelle
(
"03"
,
new
GPSCoordinate
(
10.0
,
-
15.0
),
estado
.
OPERATIVO
,
10
,
3
,
true
,
false
);
Puerto
puertoConexion
=
new
Puerto
(
"IT"
,
"NAP"
);
puertoConexion
.
anyadirMuelle
(
muelleConexion
);
Fecha
fechaConexion
=
new
Fecha
(
25
,
10
,
2015
);
TCamion
tc
=
new
TCamion
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleConexion
,
puertoConexion
,
fechaConexion
);
TBarco
tb
=
new
TBarco
(
muelleConexion
,
puertoConexion
,
fechaConexion
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
);
trayectosSimples
.
add
(
tc
);
trayectosSimples
.
add
(
tb
);
PackCamionBarco
pcb
=
new
PackCamionBarco
(
muelleOrigen
,
puertoOrigen
,
fechaInicioTrayecto
,
muelleDestino
,
puertoDestino
,
fechaFinTrayecto
,
trayectosSimples
);
assertEquals
(
pcb
.
costeTrayecto
(),
48002.33
,
0.01f
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment