### Question:
ColocUtil { public static void setPhases(SortedSet<Phase> list, String start, String end) { Phase startPhase = new Phase(start, 1); Phase endPhase = new Phase(end, 2); Iterator<Phase> iter = list.iterator(); boolean remove = true; while (iter.hasNext()) { Phase p = iter.next(); if (remove && p.getName().equals(startPhase.getName())) { remove = false; } else if (p.getName().equals(endPhase.getName())) { remove = true; } else if (remove) { iter.remove(); } } } private  ColocUtil(); static void setPhases(SortedSet<Phase> list, String start, String end); static InterceptorChain getOutInterceptorChain(Exchange ex, SortedSet<Phase> phases); static InterceptorChain getInInterceptorChain(Exchange ex, SortedSet<Phase> phases); static boolean isSameOperationInfo(OperationInfo oi1, OperationInfo oi2); static boolean isCompatibleOperationInfo(OperationInfo oi1, OperationInfo oi2); static boolean isAssignableOperationInfo(OperationInfo oi, Class<?> cls); static boolean isSameMessageInfo(MessageInfo mi1, MessageInfo mi2); static boolean isSameFaultInfo(Collection<FaultInfo> fil1,
                                          Collection<FaultInfo> fil2); static void convertSourceToObject(Message message); static void convertObjectToSource(Message message);  }### Answer:
@Test public void testSetColocInPhases() throws Exception { PhaseManagerImpl phaseMgr = new PhaseManagerImpl(); SortedSet<Phase> list = phaseMgr.getInPhases(); int size1 = list.size(); ColocUtil.setPhases(list, Phase.USER_LOGICAL, Phase.INVOKE); assertNotSame("The list size should not be same", size1, list.size()); assertEquals("Expecting Phase.USER_LOGICAL", list.first().getName(), Phase.USER_LOGICAL); assertEquals("Expecting Phase.POST_INVOKE", list.last().getName(), Phase.INVOKE); }
@Test public void testSetColocOutPhases() throws Exception { PhaseManagerImpl phaseMgr = new PhaseManagerImpl(); SortedSet<Phase> list = phaseMgr.getOutPhases(); int size1 = list.size(); ColocUtil.setPhases(list, Phase.SETUP, Phase.POST_LOGICAL); assertNotSame("The list size should not be same", size1, list.size()); assertEquals("Expecting Phase.SETUP", list.first().getName(), Phase.SETUP); assertEquals("Expecting Phase.POST_LOGICAL", list.last().getName(), Phase.POST_LOGICAL); }