示例#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);
  }
示例#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)));
  }
示例#3
0
  @Test
  public void twoPeriodsAreNotEqualIfTheyHaveUnequalCodes() {

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

    assertNotEquals(period, other);
  }
示例#4
0
  @Test
  public void twoPeriodsAreEqualIfTheyBelongToEqualParentsAndHaveEqualCodes() {

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

    assertEquals(period, other);
    assertEquals(period.hashCode(), other.hashCode());
  }
示例#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)));
  }