@Test
	public void timer() {
		final List<Long> expecteds=Arrays.asList(1L,2L,3L,4L,5L);
		final List<Long> actuals=new ArrayList<Long>();
		
		final Timer timer = new Timer(1000, 5);

		timer.addEventListener(TimerEvent.TIMER, new EventListener() {
			@Override
			public void handleEvent(Event event) {
				System.out.println("timer tick " + timer.getCurrentCount());
				System.out.println(JSON.toJSONString(timer, true));
				actuals.add(timer.getCurrentCount());
			}
		});

		timer.addEventListener(TimerEvent.TIMER, new EventListener() {
			@Override
			public void handleEvent(Event event) {
				if (timer.getCurrentCount() == 3) {
					System.out.println("timer stop");
					timer.stop();
					try {
						Thread.sleep(2000);
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
					System.out.println("timer start");
					timer.start();
				}
			}
		});

		timer.addEventListener(TimerEvent.TIMER_COMPLETE, new EventListener() {
			@Override
			public void handleEvent(Event event) {
				System.out.println("timer complete");
				System.out.println(JSON.toJSONString(timer, true));
				lock.countDown();
			}
		});
		
		System.out.println("timer beforestart");
		System.out.println(JSON.toJSONString(timer, true));
		timer.start();
		
		try {
			lock.await(10000, TimeUnit.MILLISECONDS);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		System.out.println(Arrays.toString(expecteds.toArray()));
		System.out.println(Arrays.toString(actuals.toArray()));
		Assert.assertArrayEquals(expecteds.toArray(), actuals.toArray());
	}