コード例 #1
0
 @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);
 }
コード例 #2
0
  @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);
  }
コード例 #3
0
  @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);
  }
コード例 #4
0
  @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);
  }
コード例 #5
0
 /** @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());
 }
コード例 #6
0
 @Test
 public void shouldCreateControl_SetWizardPageControl() throws Exception {
   wizardPageUnderTest.createControl(realmWithDisplay.createComposite());
   assertThat(wizardPageUnderTest.getControl()).isNotNull();
 }