Package org.jboss.forge.addon.ui.impl.mock

Examples of org.jboss.forge.addon.ui.impl.mock.MockUIContext


   }

   @Test
   public void testRequiredWithMessage()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      requiredWithMessage.validate(context);
      List<String> errors = context.getErrorsFor(requiredWithMessage);
      Assert.assertThat(errors, notNullValue());
      Assert.assertThat(errors.size(), equalTo(1));
View Full Code Here


   }

   @Test
   public void testRequiredNoMessage()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      requiredNoMessage.validate(context);
      List<String> errors = context.getErrorsFor(requiredNoMessage);
      Assert.assertThat(errors, notNullValue());
      Assert.assertThat(errors.size(), equalTo(1));
View Full Code Here

   }

   @Test
   public void testNotRequired()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      notRequired.validate(context);
      List<String> errors = context.getErrorsFor(notRequired);
      Assert.assertThat(errors, nullValue());
   }
View Full Code Here

   }

   @Test
   public void testAdditionalValidator()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      withValidator.addValidator(new UIValidator()
      {
         @Override
         public void validate(UIValidationContext validator)
View Full Code Here

   }

   @Test
   public void testDoNotValidateOnNullValues()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      withValidator.addValidator(new UIValidator()
      {
         @Override
         public void validate(UIValidationContext validator)
View Full Code Here

   }

   @Test
   public void testRequiredAndAdditionalValidator()
   {
      UIContext ctx = new MockUIContext();
      MockValidationContext context = new MockValidationContext(ctx);
      requiredNoMessage.addValidator(new UIValidator()
      {
         @Override
         public void validate(UIValidationContext validator)
View Full Code Here

      Assert.assertNotNull(commands);

      int count = 0;
      for (UICommand command : commands)
      {
         UICommandMetadata metadata = command.getMetadata(new MockUIContext());
         Assert.assertTrue(ExampleCommand.class.equals(metadata.getType())
                  || ExampleNoUICommand.class.equals(metadata.getType())
                  || ExampleAnnotatedCommand.class.equals(metadata.getType())
                  || DifferentNameCommand.class.equals(metadata.getType())
                  );
View Full Code Here

   @Test
   public void testCommandCache()
   {
      String commandName = ExampleCommand.class.getName();
      MockUIContext context = new MockUIContext();
      UICommand command = commandFactory.getCommandByName(context, commandName);
      Assert.assertNotNull(command);
      Assert.assertSame(command, commandFactory.getCommandByName(context, commandName));
      Assert.assertNotSame(command, commandFactory.getNewCommandByName(context, commandName));
   }
View Full Code Here

   }

   @Test
   public void testCommandByNameLookup()
   {
      MockUIContext context = new MockUIContext();
      context.getProvider().setGUI(false);
      Assert.assertNotNull(commandFactory.getCommandByName(context, "a-gui-command"));
      Assert.assertNotNull(commandFactory.getCommandByName(context, "a-shell-command"));
      Assert.assertNull(commandFactory.getCommandByName(context, "an-invalid-command"));
      context.getProvider().setGUI(true);
      Assert.assertNotNull(commandFactory.getCommandByName(context, "a-gui-command"));
      Assert.assertNotNull(commandFactory.getCommandByName(context, "a-shell-command"));
      Assert.assertNull(commandFactory.getCommandByName(context, "an-invalid-command"));
   }
View Full Code Here

   private FlowExampleWizard flowExampleWizard;

   @Test
   public void testWizardExecutionListener() throws Exception
   {
      MockUIContext context = new MockUIContext();
      WizardTestListener wizardListener = new WizardTestListener();
      context.addCommandExecutionListener(wizardListener);

      try (CommandController controller = controllerFactory.createWizardController(context, new MockUIRuntime(),
               flowExampleWizard))
      {
         controller.initialize();
View Full Code Here

TOP

Related Classes of org.jboss.forge.addon.ui.impl.mock.MockUIContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.