Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Agriterix
simulator
Commits
77d109e9
Commit
77d109e9
authored
Jul 29, 2021
by
Loris Croce
Browse files
add test practice match tag
parent
2247da05
Pipeline
#38474
passed with stages
in 5 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/fr/inrae/agriterix/simulator/Patch.java
View file @
77d109e9
...
...
@@ -117,6 +117,9 @@ public class Patch {
public
CulturalPractice
getCulturalPractice
()
{
return
practice
;
}
public
void
setCulturalPractice
(
CulturalPractice
culturalPractice
)
{
this
.
practice
=
culturalPractice
;
}
public
int
getId
()
{
return
id
;
...
...
src/test/java/fr/inrae/agriterix/simulator/PatchTest.java
View file @
77d109e9
...
...
@@ -35,6 +35,16 @@ public class PatchTest {
GeoArea
g
=
new
GeoArea
();
Product
p
=
new
Product
(
"Blé"
,
Unit
.
Kg
,
2
f
);
Patch
patch
=
new
Patch
(
g
,
42
f
,
CulturalPractice
.
I
,
p
,
42
);
assertEquals
(
patch
.
getYield
(),
Float
.
valueOf
(
2
f
*
1.25f
));
assertEquals
(
patch
.
getYield
(),
Float
.
valueOf
(
2
f
*
1.25f
));
}
@Test
public
void
testPracticeChangeAffectsTags
()
{
Patch
patch
=
new
Patch
(
new
GeoArea
(),
420
.
f
,
CulturalPractice
.
O
,
new
Product
(
"Blé"
,
Unit
.
Kg
),
42
);
Product
blebio
=
new
Product
(
"Blé"
,
Unit
.
Kg
);
blebio
.
addTag
(
Tag
.
B
);
assert
(
patch
.
produce
().
containsKey
(
blebio
));
patch
.
setCulturalPractice
(
CulturalPractice
.
I
);
assert
(
patch
.
produce
().
containsKey
(
new
Product
(
"Blé"
,
Unit
.
Kg
)));
}
}
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