Here you can find the source of removeLastTest(Deque
public static void removeLastTest(Deque<Object> q)
//package com.java2s; //License from project: Apache License import java.util.Deque; public class Main { public static void removeLastTest(Deque<Object> q) { Object firstObject = new Object(); Object lastObject = new Object(); q.addLast(firstObject);//from w ww. j a v a 2 s . c o m q.addLast(lastObject); verify(q.removeLast() == lastObject); verify(q.removeLast() == firstObject); } private static void verify(boolean val) { if (!val) { throw new RuntimeException(); } } }