@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();
 }
  @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());
  }