@Test public void testGetMandatoryDocumentsList() { // use LinkedHashMap to preserve inserting order. mdCompositor.mandatoryDocumentsMap = new LinkedHashMap<String, IMandatoryDocumentRole>(); IMandatoryDocumentRole mockA_mandDoc = createMockAndAddToDefault(IMandatoryDocumentRole.class); expect(mockA_mandDoc.dependsOnMandatoryDocuments()) .andReturn(Collections.<String>emptyList()) .atLeastOnce(); IMandatoryDocumentRole mockB_mandDocDepA = createMockAndAddToDefault(IMandatoryDocumentRole.class); expect(mockB_mandDocDepA.dependsOnMandatoryDocuments()) .andReturn(Arrays.asList("A_mandDoc")) .atLeastOnce(); mdCompositor.mandatoryDocumentsMap.put("B_mandDocDepA", mockB_mandDocDepA); mdCompositor.mandatoryDocumentsMap.put("A_mandDoc", mockA_mandDoc); replayDefault(); List<String> expectedExedList = Arrays.asList("A_mandDoc", "B_mandDocDepA"); assertFalse( "check precondition", expectedExedList.equals( new ArrayList<String>(mdCompositor.mandatoryDocumentsMap.keySet()))); assertEquals(expectedExedList, mdCompositor.getMandatoryDocumentsList()); verifyDefault(); }
@Before public void setUp_MandatoryDocumentCompositorTest() throws Exception { mdCompositor = new MandatoryDocumentCompositor(); mdCompositor.execution = Utils.getComponent(Execution.class); mdCompositor.mandatoryDocumentsMap = new HashMap<String, IMandatoryDocumentRole>(); }