RouteContext context = mock(RouteContext.class);
DocumentRouteHeaderValue docHdr = mock(DocumentRouteHeaderValue.class);
when(context.getDocument()).thenReturn(docHdr);
MatterWork work = mock(MatterWork.class);
MatterAnnexType annexType = new MatterAnnexType();
when(work.getAnnexType()).thenReturn(annexType);
final String documentId = "2013";
when(docHdr.getDocumentId()).thenReturn(documentId);
when(boSvc.findBySinglePrimaryKey(same(MatterWork.class), same(documentId))).thenReturn(work);
assertTrue("branch list should be empty since requiresApproval is by default false",
annexTypeApprovalSplit.process(context, null).getBranchNames().isEmpty());
annexType.setRequiresApproval(true);
final List<String> branchNames = annexTypeApprovalSplit.process(context, null).getBranchNames();
assertFalse("branch list should not be empty since requiresApproval is set to true", branchNames.isEmpty());
assertEquals("branch name differs", MartinlawConstants.RoutingBranches.ANNEX_TYPE_APPROVAL, branchNames.get(0));
when(work.getAnnexType()).thenReturn(null);