Ejemplo n.º 1
0
 @Test
 public void
     linkContainsCellsCorrespondingToInJunctionFollowedByCellsInCellChainFollowedByOutJunction()
         throws Exception {
   context.checking(
       new Expectations() {
         {
           oneOf(cellChain).iterator();
           will(returnIterator(linkCell0, linkCell1));
         }
       });
   assertThat(link.cells(), contains(inJunction, linkCell0, linkCell1, outJunction));
 }
Ejemplo n.º 2
0
 @Test
 public void getCellAtIndexReturnsDelgatesCallToCellChain() throws Exception {
   context.checking(
       new Expectations() {
         {
           oneOf(cellChain).getCellAtIndex(0);
           will(returnValue(linkCell0));
           oneOf(cellChain).getCellAtIndex(1);
           will(returnValue(linkCell1));
         }
       });
   assertThat(link.getCell(0), is(linkCell0));
   assertThat(link.getCell(1), is(linkCell1));
 }
Ejemplo n.º 3
0
  @Test
  public void occupancyReturnsLinkOccupancyObject() throws Exception {
    defineExpectationsForOccupancyOnCellChain();
    defineExpectationsForCapacityOnCellChain();

    context.checking(
        new Expectations() {
          {
            oneOf(occupancyFactory).create(occupancy, capacity);
            will(returnValue(occupancyMeasure));
            oneOf(linkOccupancyFactory).create(link, occupancyMeasure);
            will(returnValue(linkOccupancy));
          }
        });
    assertThat(link.occupancy(), is(linkOccupancy));
  }
Ejemplo n.º 4
0
 @Test
 public void congestionReturnsValueOfOccupancyDividedByCapacity() throws Exception {
   defineExpectationsForOccupancyOnCellChain();
   defineExpectationsForCapacityOnCellChain();
   assertThat(link.congestion(), is(0.4));
 }