Ejemplo n.º 1
0
  @Test
  public void twoPeriodsAreNotEqualIfTheyBelongToUnequalParents() {

    FinancialPeriod other = new FinancialPeriod(period.getCode());
    FinancialPeriod otherParent = new FinancialPeriod(parent.getCode() + "X");
    otherParent.addChild(other);

    assertNotEquals(period, other);
  }
Ejemplo n.º 2
0
  @Test
  public void twoPeriodsAreEqualUnderTheComparableContractBecauseHaveEqualCodesAtTheSameLevel() {

    FinancialPeriod other = new FinancialPeriod(period.getCode());
    FinancialPeriod otherParent = new FinancialPeriod(parent.getCode());
    otherParent.addChild(other);

    assertThat(period, is(lessThanOrEqualTo(other)));
    assertThat(period, is(greaterThanOrEqualTo(other)));
  }
Ejemplo n.º 3
0
  @Test
  public void twoPeriodsAreNotEqualIfTheyHaveUnequalCodes() {

    FinancialPeriod other = new FinancialPeriod(period.getCode() + "Y");
    parent.addChild(other);

    assertNotEquals(period, other);
  }
Ejemplo n.º 4
0
  @Test
  public void twoPeriodsAreEqualIfTheyBelongToEqualParentsAndHaveEqualCodes() {

    FinancialPeriod other = new FinancialPeriod(period.getCode());
    parent.addChild(other);

    assertEquals(period, other);
    assertEquals(period.hashCode(), other.hashCode());
  }
Ejemplo n.º 5
0
  @Test
  public void aPeriodIsLessThanOtherBasedOnItsCodeCoparison() {

    FinancialPeriod other = new FinancialPeriod("Q2");
    FinancialPeriod otherParent = new FinancialPeriod(parent.getCode());
    otherParent.addChild(other);

    assertThat(period, is(lessThan(other)));
  }