@Test public void shoudlGetAllBusinessObjects_ReturnAllAvailableEntities() throws Exception { final BusinessObject bo1 = new BusinessObject(); final BusinessObject bo2 = new BusinessObject(); when(fileStore.getBusinessObjects()).thenReturn(newArrayList(bo1, bo2)); assertThat(wizardPageUnderTest.getAllBusinessObjects()).containsOnly(bo1, bo2); }
@Test public void should_reject_empty_data_name() throws Exception { final EMFDataBindingContext ctx = new EMFDataBindingContext(); final Text nameText = wizardPageUnderTest.createNameControl(realmWithDisplay.createComposite(), ctx); nameText.setText(""); assertThat(validationStatuses(ctx)) .extracting("validationStatus.value.severity") .contains(IStatus.ERROR); }
@Test public void should_accept_valid_data_name() throws Exception { final EMFDataBindingContext ctx = new EMFDataBindingContext(); final Text nameText = wizardPageUnderTest.createNameControl(realmWithDisplay.createComposite(), ctx); nameText.setText("currentLeaveRequest"); assertThat(validationStatuses(ctx)) .extracting("validationStatus.value.severity") .containsOnly(IStatus.OK); }
@Test public void should_reject_data_name_longer_than_50_characters() throws Exception { final EMFDataBindingContext ctx = new EMFDataBindingContext(); final Text nameText = wizardPageUnderTest.createNameControl(realmWithDisplay.createComposite(), ctx); nameText.setText("aBusinessDataNameWithWayToManyCharactersMakingTheValidationFail"); assertThat(validationStatuses(ctx)) .extracting("validationStatus.value.severity") .contains(IStatus.ERROR); }
/** @throws java.lang.Exception */ @Before public void setUp() throws Exception { final BusinessObjectModelRepositoryStore store = mock(BusinessObjectModelRepositoryStore.class); when(store.getChildren()).thenReturn(Collections.singletonList(fileStore)); final BusinessObjectData data = aBusinessData() .havingDataType(BusinessObjectDataTypeBuilder.aBusinessObjectDataType()) .build(); final Pool pool = aPool().build(); pool.getData().add(data); wizardPageUnderTest = new BusinessObjectDataWizardPage(pool, data, store, newHashSet("data1"), hintImageProvider); doReturn(realmWithDisplay.createImage()).when(hintImageProvider).getHintImage(); wizardPageUnderTest.setWizard(wizardWithContainer); when(wizardWithContainer.getContainer()).thenReturn(wizardContainer); when(wizardContainer.getShell()).thenReturn(realmWithDisplay.getShell()); }
@Test public void shouldCreateControl_SetWizardPageControl() throws Exception { wizardPageUnderTest.createControl(realmWithDisplay.createComposite()); assertThat(wizardPageUnderTest.getControl()).isNotNull(); }