Commit 77d109e9 authored by Loris Croce's avatar Loris Croce
Browse files

add test practice match tag

parent 2247da05
Pipeline #38474 passed with stages
in 5 minutes and 21 seconds
...@@ -117,6 +117,9 @@ public class Patch { ...@@ -117,6 +117,9 @@ public class Patch {
public CulturalPractice getCulturalPractice() { public CulturalPractice getCulturalPractice() {
return practice; return practice;
} }
public void setCulturalPractice(CulturalPractice culturalPractice) {
this.practice = culturalPractice;
}
public int getId() { public int getId() {
return id; return id;
......
...@@ -35,6 +35,16 @@ public class PatchTest { ...@@ -35,6 +35,16 @@ public class PatchTest {
GeoArea g = new GeoArea(); GeoArea g = new GeoArea();
Product p = new Product("Blé", Unit.Kg, 2f); Product p = new Product("Blé", Unit.Kg, 2f);
Patch patch = new Patch(g, 42f, CulturalPractice.I, p, 42); Patch patch = new Patch(g, 42f, CulturalPractice.I, p, 42);
assertEquals(patch.getYield(), Float.valueOf(2f*1.25f)); assertEquals(patch.getYield(), Float.valueOf(2f * 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)));
} }
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment