Created
February 12, 2013 13:38
-
-
Save ksiwonia/4769932 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class AvgLaborCostCalcForOrderDetailsHooksTest { | |
private AvgLaborCostCalcForOrderDetailsHooks orderDetailsHooks; | |
@Mock | |
private ViewDefinitionState view; | |
@Mock | |
private FieldComponent averageLaborHourlyCost; | |
@Mock | |
private WindowComponentState window; | |
@Mock | |
private Ribbon ribbon; | |
@Mock | |
private RibbonGroup hourlyCostNorms; | |
@Mock | |
private RibbonActionItem copyToOperationsNorms; | |
@Before | |
public void init() { | |
orderDetailsHooks = new AvgLaborCostCalcForOrderDetailsHooks(); | |
MockitoAnnotations.initMocks(this); | |
} | |
@Test | |
public void shouldEnabledButtonForCopyNorms() throws Exception { | |
// given | |
String averageLaborHourlyCostValue = "50"; | |
when(view.getComponentByReference("window")).thenReturn((ComponentState) window); | |
when(window.getRibbon()).thenReturn(ribbon); | |
when(ribbon.getGroupByName("hourlyCostNorms")).thenReturn(hourlyCostNorms); | |
when(window.getRibbon().getGroupByName("hourlyCostNorms").getItemByName("copyToOperationsNorms")).thenReturn( | |
copyToOperationsNorms); | |
when(view.getComponentByReference("averageLaborHourlyCost")).thenReturn(averageLaborHourlyCost); | |
when(averageLaborHourlyCost.getFieldValue()).thenReturn(averageLaborHourlyCostValue); | |
// when | |
orderDetailsHooks.enabledButtonForCopyNorms(view); | |
// then | |
Mockito.verify(copyToOperationsNorms).setEnabled(true); | |
} | |
@After | |
public void flush() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment