Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added rule T8 with Testcases

  • Loading branch information...
commit f4af9eae202a01f84bd06a1aafe0d81b020dbebd 1 parent bb93c67
@damirkusar damirkusar authored
View
17 src/main/java/ch/hslu/danwi/rules/Person.java
@@ -8,6 +8,7 @@
private int aufenthaltsTage;
private ThreeValuedBoolean erwerbstaetig = ThreeValuedBoolean.UNKNOWN;
private ThreeValuedBoolean hatVerantwortung = ThreeValuedBoolean.UNKNOWN;
+ private ThreeValuedBoolean minderjaehrigeKinder = ThreeValuedBoolean.UNKNOWN;
private String Hauptsteuerdomizil;
@@ -22,7 +23,7 @@
private ThreeValuedBoolean VermoegenZusammenrechnen = ThreeValuedBoolean.UNKNOWN;
private String wochenaufenthaltsort;
private String wohnsitz;
- private Zivilstand zivilstand;
+ private Zivilstand zivilstand = Zivilstand.UNKNOWN;
private int vermoegen;
private int einkommen;
@@ -206,4 +207,18 @@ public void setZivilstand(Zivilstand zivilstand) {
this.zivilstand = zivilstand;
}
+ public ThreeValuedBoolean getMinderjaehrigeKinder() {
+ return minderjaehrigeKinder;
+ }
+
+ public void setMinderjaehrigeKinder(ThreeValuedBoolean minderjaehrigeKinder) {
+ this.minderjaehrigeKinder = minderjaehrigeKinder;
+ }
+
+ public ThreeValuedBoolean getVermoegenZusammenrechnen() {
+ return VermoegenZusammenrechnen;
+ }
+
+
+
}
View
2  src/main/java/ch/hslu/danwi/rules/Zivilstand.java
@@ -1,5 +1,5 @@
package ch.hslu.danwi.rules;
public enum Zivilstand {
- LEDIG, VERHEIRATET, KONKUBINAT
+ LEDIG, VERHEIRATET, KONKUBINAT, UNKNOWN
}
View
44 src/main/java/ch/hslu/danwi/rules/test/PersonTestCase.java
@@ -19,6 +19,7 @@
import ch.hslu.danwi.rules.Person;
import ch.hslu.danwi.rules.ThreeValuedBoolean;
+import ch.hslu.danwi.rules.Zivilstand;
public class PersonTestCase {
@@ -199,6 +200,49 @@ public void testPartnerNational() {
assertEquals(ThreeValuedBoolean.UNKNOWN, person.getIndividuelleVermoegensZuordnung());
}
+ @Test
+ public void testPersonKeinPartnerKeineMinderjaehrigeKinder() {
+ person.setMinderjaehrigeKinder(ThreeValuedBoolean.FALSE);
+
+ runRules();
+ assertEquals(Zivilstand.LEDIG, person.getZivilstand());
+ }
+
+ @Test
+ public void testPersonPartnerKeineMinderjaehrigeKinder() {
+ Person partner = new Person();
+ person.setPartner(partner);
+ person.setMinderjaehrigeKinder(ThreeValuedBoolean.FALSE);
+
+ runRules();
+
+ assertEquals(Zivilstand.UNKNOWN, person.getZivilstand());
+ }
+
+ @Test
+ public void testPersonKeinPartnerMinderjaehrigeKinder() {
+ person.setMinderjaehrigeKinder(ThreeValuedBoolean.TRUE);
+
+ runRules();
+
+ assertEquals(Zivilstand.UNKNOWN, person.getZivilstand());
+ }
+
+ @Test
+ public void testPersonPartnerMinderjaehrigeKinder() {
+ Person partner = new Person();
+ person.setPartner(partner);
+ person.setMinderjaehrigeKinder(ThreeValuedBoolean.TRUE);
+
+ runRules();
+
+ assertEquals(Zivilstand.UNKNOWN, person.getZivilstand());
+ }
+
+
+
+
+
private void runRules() {
View
7 src/main/rules/steuerrechtlicherWohnsitz.drl
@@ -55,3 +55,10 @@ rule "T6"
then
p.setIndividuelleVermoegensZuordnung(ThreeValuedBoolean.TRUE);
end
+
+rule "T8"
+ when
+ p : Person(partner == null, minderjaehrigeKinder == ThreeValuedBoolean.FALSE)
+ then
+ p.setZivilstand(Zivilstand.LEDIG);
+end
Please sign in to comment.
Something went wrong with that request. Please try again.