@DisplayName("test_addLast") @Test void testAddLast() { BootProcessChain processChain = new DefaultBootProcessChain(); final List<Integer> list = new ArrayList<>(2); for (int i = 0; i < 2; i++) { final Integer tmp = i; processChain.addLast(new BootJob() { @Override public void start() { list.add(tmp); } }); } processChain.start(); assertEquals(Integer.valueOf(0), list.get(0)); assertEquals(Integer.valueOf(1), list.get(1)); }
@Override public BootProcessChain addLast(BootJob bootJob) { BootJobContext newJob = newBootJobContext(bootJob); tail.getPrev().setNext(newJob); newJob.setPrev(tail.getPrev()); tail.setPrev(newJob); newJob.setNext(tail); return this; }
DefaultBootProcessChain implements BootProcessChain { @Override public BootProcessChain addLast(BootJob bootJob) { BootJobContext newJob = newBootJobContext(bootJob); tail.getPrev().setNext(newJob); newJob.setPrev(tail.getPrev()); tail.setPrev(newJob); newJob.setNext(tail); return this; } }
DefaultBootProcessChain implements BootProcessChain { @Override public BootProcessChain addLast(BootJob bootJob) { BootJobContext newJob = newBootJobContext(bootJob); tail.getPrev().setNext(newJob); newJob.setPrev(tail.getPrev()); tail.setPrev(newJob); newJob.setNext(tail); return this; } DefaultBootProcessChain(); }
DefaultBootProcessChain implements BootProcessChain { @Override public BootProcessChain addLast(BootJob bootJob) { BootJobContext newJob = newBootJobContext(bootJob); tail.getPrev().setNext(newJob); newJob.setPrev(tail.getPrev()); tail.setPrev(newJob); newJob.setNext(tail); return this; } DefaultBootProcessChain(); @Override void start(); @Override void stop(); @Override BootProcessChain addLast(BootJob bootJob); @Override BootProcessChain addFirst(BootJob bootJob); }
DefaultBootProcessChain implements BootProcessChain { @Override public BootProcessChain addLast(BootJob bootJob) { BootJobContext newJob = newBootJobContext(bootJob); tail.getPrev().setNext(newJob); newJob.setPrev(tail.getPrev()); tail.setPrev(newJob); newJob.setNext(tail); return this; } DefaultBootProcessChain(); @Override void start(); @Override void stop(); @Override BootProcessChain addLast(BootJob bootJob); @Override BootProcessChain addFirst(BootJob bootJob);  }