Skip to content

Commit

Permalink
Fixes #101 - builder work
Browse files Browse the repository at this point in the history
* Refer to builder instead of new in more places
* Rework builder to use a facade pattern to organize the different
  subsystems of the builder
* Still could be better
  • Loading branch information
dickschoeller committed May 7, 2017
1 parent b16dfc1 commit 39ec97b
Show file tree
Hide file tree
Showing 76 changed files with 1,841 additions and 1,181 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public final class OrderAnalyzerChildrenTest implements AnalyzerTest {
*/
@Override
public PersonBuilder personBuilder() {
return builder.getPersonBuilder();
return builder;
}

/**
* {@inheritDoc}
*/
@Override
public FamilyBuilder familyBuilder() {
return builder.getFamilyBuilder();
return builder;
}

/** */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ public final class OrderAnalyzerDeathTest implements AnalyzerTest {
*/
@Override
public PersonBuilder personBuilder() {
return builder.getPersonBuilder();
return builder;
}

/**
* {@inheritDoc}
*/
@Override
public FamilyBuilder familyBuilder() {
return builder.getFamilyBuilder();
return builder;
}

/** */
@Test
public void testPersonWithOnlyDeathMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with only death event",
result.isCorrect());
Expand All @@ -60,8 +60,8 @@ public void testPersonWithOnlyDeathMatch() {
@Test
public void testPersonWithDeathAfterNonDeathMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Education");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Education");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death events are after others",
result.isCorrect());
Expand All @@ -71,8 +71,8 @@ public void testPersonWithDeathAfterNonDeathMatch() {
@Test
public void testPersonWithNonDeathAfterDeathMismatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Education");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Education");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertFalse("Expected incorrect with death events are before others",
result.isCorrect());
Expand All @@ -82,8 +82,8 @@ public void testPersonWithNonDeathAfterDeathMismatch() {
@Test
public void testPersonWithWillAfterDeathMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Will");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Will");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death before will",
result.isCorrect());
Expand All @@ -93,8 +93,8 @@ public void testPersonWithWillAfterDeathMatch() {
@Test
public void testPersonWithWillBeforeDeathMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Will");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Will");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with will before death",
result.isCorrect());
Expand All @@ -104,9 +104,9 @@ public void testPersonWithWillBeforeDeathMatch() {
@Test
public void testPersonWithWillEducDeathMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Will");
personBuilder().createPersonEvent(person, "Education");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Will");
builder.createPersonEvent(person, "Education");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with will, education, death",
result.isCorrect());
Expand All @@ -116,9 +116,9 @@ public void testPersonWithWillEducDeathMatch() {
@Test
public void testPersonWithDeathFuneralBurialMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Funeral");
personBuilder().createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Funeral");
builder.createPersonEvent(person, "Burial");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death, funeral, burial",
result.isCorrect());
Expand All @@ -128,8 +128,8 @@ public void testPersonWithDeathFuneralBurialMatch() {
@Test
public void testPersonWithDeathBurialMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Burial");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death, burial",
result.isCorrect());
Expand All @@ -139,9 +139,9 @@ public void testPersonWithDeathBurialMatch() {
@Test
public void testPersonWithFuneralBurialDeathMismatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Funeral");
personBuilder().createPersonEvent(person, "Burial");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Funeral");
builder.createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertFalse("Expected incorrect with funeral, burial, death",
result.isCorrect());
Expand All @@ -151,9 +151,9 @@ public void testPersonWithFuneralBurialDeathMismatch() {
@Test
public void testPersonWithDeathBurialDeathMismatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Burial");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertFalse("Expected incorrect with death, burial, death",
result.isCorrect());
Expand All @@ -163,9 +163,9 @@ public void testPersonWithDeathBurialDeathMismatch() {
@Test
public void testPersonWithBurialBurialBurialMatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Burial");
personBuilder().createPersonEvent(person, "Burial");
personBuilder().createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Burial");
builder.createPersonEvent(person, "Burial");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with burial, burial, burial",
result.isCorrect());
Expand All @@ -175,9 +175,9 @@ public void testPersonWithBurialBurialBurialMatch() {
@Test
public void testPersonWithDeathDeathDeathMismatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death, death, death",
result.isCorrect());
Expand All @@ -187,9 +187,9 @@ public void testPersonWithDeathDeathDeathMismatch() {
@Test
public void testPersonWithDeathWillDeathMismatch() {
final Person person = createJRandom();
personBuilder().createPersonEvent(person, "Death");
personBuilder().createPersonEvent(person, "Will");
personBuilder().createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Death");
builder.createPersonEvent(person, "Will");
builder.createPersonEvent(person, "Death");
final OrderAnalyzerResult result = wrapper.analyze(person);
assertTrue("Expected correct with death, will, death",
result.isCorrect());
Expand All @@ -201,7 +201,7 @@ public void testPersonWithDeathWillDeathMismatch() {
public void testDeathIsDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Death");
builder.createPersonEvent(person1, "Death");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Death is death", analyzer.isDeathEvent(event));
}
Expand All @@ -211,7 +211,7 @@ public void testDeathIsDeath() {
public void testBurialIsNotDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Burial");
builder.createPersonEvent(person1, "Burial");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertFalse("Burial is not death", analyzer.isDeathEvent(event));
}
Expand All @@ -221,7 +221,7 @@ public void testBurialIsNotDeath() {
public void testDeathIsDeathRelated() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Death");
builder.createPersonEvent(person1, "Death");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Death is death related",
analyzer.isDeathRelatedEvent(event));
Expand All @@ -232,7 +232,7 @@ public void testDeathIsDeathRelated() {
public void testBurialIsDeathRelated() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Burial");
builder.createPersonEvent(person1, "Burial");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Burial is death related",
analyzer.isDeathRelatedEvent(event));
Expand All @@ -243,7 +243,7 @@ public void testBurialIsDeathRelated() {
public void testCremationIsDeathRelated() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Cremation");
builder.createPersonEvent(person1, "Cremation");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Cremation is death related",
analyzer.isDeathRelatedEvent(event));
Expand All @@ -253,7 +253,7 @@ public void testCremationIsDeathRelated() {
@Test
public void testUnveilingIsDeathRelated() {
final Person person1 = createJRandom();
final Attribute event = personBuilder().createPersonEvent(
final Attribute event = builder.createPersonEvent(
person1, "Headstone unveiling");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Unveiling is death related",
Expand All @@ -265,7 +265,7 @@ public void testUnveilingIsDeathRelated() {
public void testWillIsDeathRelated() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Will");
builder.createPersonEvent(person1, "Will");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Will is death related",
analyzer.isDeathRelatedEvent(event));
Expand All @@ -276,7 +276,7 @@ public void testWillIsDeathRelated() {
public void testDeathIsNotPostDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Death");
builder.createPersonEvent(person1, "Death");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertFalse("Death is not post death",
analyzer.isPostDeathEvent(event));
Expand All @@ -287,7 +287,7 @@ public void testDeathIsNotPostDeath() {
public void testBurialIsPostDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Burial");
builder.createPersonEvent(person1, "Burial");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Burial is post death",
analyzer.isPostDeathEvent(event));
Expand All @@ -298,7 +298,7 @@ public void testBurialIsPostDeath() {
public void testCremationIsPostDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Cremation");
builder.createPersonEvent(person1, "Cremation");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Cremation is post death",
analyzer.isPostDeathEvent(event));
Expand All @@ -308,7 +308,7 @@ public void testCremationIsPostDeath() {
@Test
public void testUnveilingIsPostDeath() {
final Person person1 = createJRandom();
final Attribute event = personBuilder().createPersonEvent(
final Attribute event = builder.createPersonEvent(
person1, "Headstone unveiling");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Unveiling is post death",
Expand All @@ -320,7 +320,7 @@ public void testUnveilingIsPostDeath() {
public void testFuneralIsPostDeath() {
final Person person1 = createJRandom();
final Attribute event =
personBuilder().createPersonEvent(person1, "Funeral");
builder.createPersonEvent(person1, "Funeral");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Funeral is post death",
analyzer.isPostDeathEvent(event));
Expand All @@ -330,7 +330,7 @@ public void testFuneralIsPostDeath() {
@Test
public void testWillIsNotPostDeath() {
final Person person1 = createJRandom();
final Attribute event = personBuilder().createPersonEvent(
final Attribute event = builder.createPersonEvent(
person1, "Will");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertFalse("Will is not post death",
Expand All @@ -341,7 +341,7 @@ public void testWillIsNotPostDeath() {
@Test
public void testDeathIsNotUnordered() {
final Person person1 = createJRandom();
final Attribute event = personBuilder().createPersonEvent(
final Attribute event = builder.createPersonEvent(
person1, "Death");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertFalse("Death is ordered", analyzer.isUnorderedEvent(event));
Expand All @@ -351,7 +351,7 @@ public void testDeathIsNotUnordered() {
@Test
public void testWillIsUnordered() {
final Person person1 = createJRandom();
final Attribute event = personBuilder().createPersonEvent(
final Attribute event = builder.createPersonEvent(
person1, "Will");
final OrderAnalyzer analyzer = new OrderAnalyzer(person1);
assertTrue("Will is unordered", analyzer.isUnorderedEvent(event));
Expand Down
Loading

0 comments on commit 39ec97b

Please sign in to comment.