コード例 #1
0
 @Before
 public final void setUp() throws Exception {
   engine = new DefaultKnittingEngine(knittingFactory);
   List<Needle> needles = new ArrayList<Needle>();
   needles.add(initialNeedle);
   engine.useNeedles(needles);
   engine.castOn(40, true);
   assertOriginalState();
   save();
 }
コード例 #2
0
  @Test
  public void checkNeedleReturned() throws Exception {
    Needle newNeedle = knittingFactory.createNeedle("new-needle", NeedleStyle.CIRCULAR);
    List<Needle> needles = new ArrayList<Needle>();
    needles.add(newNeedle);
    engine.useNeedles(needles);
    engine.castOn(5);

    restore();
    // note that needles which were not in the engine
    // are not affected by the restore
    assertEquals(5, newNeedle.getTotalStitches());
  }