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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
javcalv
Entrega_javcalv_victorm
Commits
485a95e9
Commit
485a95e9
authored
10 months ago
by
Javier Calvo
Browse files
Options
Downloads
Patches
Plain Diff
MuelleTest haciendolo
parent
e3f2e1ea
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/Muelle.java
+11
-3
11 additions, 3 deletions
src/es/markse/Muelle.java
src/es/markse/Plaza.java
+1
-2
1 addition, 2 deletions
src/es/markse/Plaza.java
uses/es/markse/MuelleTest.java
+139
-0
139 additions, 0 deletions
uses/es/markse/MuelleTest.java
with
151 additions
and
5 deletions
src/es/markse/Muelle.java
+
11
−
3
View file @
485a95e9
...
...
@@ -28,16 +28,24 @@ public class Muelle {
* @param altura numero maximo de contenedores que se pueden apilar encima de otro
*/
public
Muelle
(
String
identificador
,
GPSCoordinate
cord
,
boolean
operativo
,
int
plazas
,
int
altura
)
{
comprobarValoresNulos
(
identificador
,
cord
);
comprobarValoresMuelle
(
identificador
,
plazas
,
altura
);
this
.
identificador
=
identificador
;
this
.
cord
=
cord
;
this
.
operativo
=
operativo
;
this
.
plazas
=
new
Plaza
[
plazas
];
this
.
plazasVacias
=
plazas
;
this
.
plazas
=
new
Plaza
[
plazas
];
this
.
operativo
=
operativo
;
//Inicializamos el array de las plazas
for
(
int
i
=
0
;
i
<
plazas
;
i
++)
{
this
.
plazas
[
i
]
=
new
Plaza
(
altura
);
}
}
private
void
comprobarValoresNulos
(
String
identificador
,
GPSCoordinate
cord
)
{
if
(
identificador
==
null
)
throw
new
IllegalArgumentException
(
"Identificador no puede ser nulo"
);
if
(
cord
==
null
)
throw
new
IllegalArgumentException
(
"Identificador no puede ser nulo"
);
}
/**
...
...
This diff is collapsed.
Click to expand it.
src/es/markse/Plaza.java
+
1
−
2
View file @
485a95e9
...
...
@@ -110,5 +110,4 @@ public class Plaza {
public
int
altura
()
{
return
this
.
altura
;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
uses/es/markse/MuelleTest.java
0 → 100644
+
139
−
0
View file @
485a95e9
/**
* Copyrigth Universidad de Valladolid 2024/2025
*/
package
es.markse
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
import
es.uva.inf.poo.maps.GPSCoordinate
;
/**
* Realizacion de los Test de la Clase Muelle. Esta clase gestiona la propia clase Plaza, por lo que
* en la realizacion de estos test se probaran los funcionamientos de los metodos de la clase Plaza.
* @author javcalv
* @author victorm
*/
public
class
MuelleTest
{
@Test
public
final
void
testMuelle
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
Muelle
m
=
new
Muelle
(
"01"
,
cord
,
true
,
2
,
2
);
assertEquals
(
"01"
,
m
.
getIdentificador
());
assertEquals
(
cord
,
m
.
getGPSCoordinate
());
assertTrue
(
m
.
estaOperativo
());
assertEquals
(
2
,
m
.
numeroDePlazasTotales
());
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
final
void
testMuelleIdentificadorVacio
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
new
Muelle
(
null
,
cord
,
true
,
2
,
2
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
final
void
testMuelleGPSVacio
()
{
new
Muelle
(
"04"
,
null
,
true
,
2
,
2
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
final
void
testMuelleIdentificadorInalido
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
new
Muelle
(
"r3"
,
cord
,
true
,
2
,
2
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
final
void
testMuellePlazasInvalida
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
new
Muelle
(
"12"
,
cord
,
true
,
-
3
,
2
);
}
@Test
(
expected
=
IllegalArgumentException
.
class
)
public
final
void
testMuelleAlturaInvalida
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
new
Muelle
(
"12"
,
cord
,
true
,
1
,-
2
);
}
@Test
public
final
void
testGetIdentificador
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
Muelle
m
=
new
Muelle
(
"01"
,
cord
,
true
,
2
,
2
);
assertEquals
(
"01"
,
m
.
getIdentificador
());
}
@Test
public
final
void
testEstaOperativo
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
Muelle
m1
=
new
Muelle
(
"01"
,
cord
,
true
,
2
,
2
);
Muelle
m2
=
new
Muelle
(
"02"
,
cord
,
false
,
2
,
2
);
assertTrue
(
m1
.
estaOperativo
());
assertFalse
(
m2
.
estaOperativo
());
}
@Test
public
final
void
testGetGPSCoordinate
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
Muelle
m
=
new
Muelle
(
"01"
,
cord
,
true
,
2
,
2
);
assertEquals
(
cord
,
m
.
getGPSCoordinate
());
}
@Test
public
final
void
testNumeroDePlazasTotales
()
{
GPSCoordinate
cord
=
new
GPSCoordinate
(
5
d
,
5
d
);
Muelle
m
=
new
Muelle
(
"01"
,
cord
,
true
,
2
,
2
);
assertEquals
(
2
,
m
.
numeroDePlazasTotales
());
}
/*
@Test
public final void testPlazasVacias() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testPlazasLlenas() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testPlazasSemillenas() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testPlazaActual() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testNivelEnPlaza() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testColocarContenedorEnPlaza() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testSacarContenedorDePlaza() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testAlternarTechoContenedor() {
fail("Not yet implemented"); // TODO
}
@Test
public final void testAlternarOperativo() {
fail("Not yet implemented"); // TODO
}
*/
}
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
sign in
to comment