Examples of BooleanConverter


Examples of org.apache.wicket.util.convert.converter.BooleanConverter

  /**
   * Test boolean conversions.
   */
  public void testBooleanConversions()
  {
    BooleanConverter booleanConverter = new BooleanConverter();
    assertEquals("true", booleanConverter.convertToString(Boolean.TRUE, Locale.getDefault()));
    assertEquals("false", booleanConverter.convertToString(Boolean.FALSE, Locale.getDefault()));
    assertEquals(Boolean.TRUE, booleanConverter.convertToObject("true", Locale.getDefault()));
    assertEquals(Boolean.FALSE, booleanConverter.convertToObject("false", Locale.getDefault()));
    try
    {
      booleanConverter.convertToObject("whatever", Locale.getDefault());
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

Examples of org.codehaus.plexus.component.configurator.converters.basic.BooleanConverter

    }


    private void registerDefaultBasicConverters()
    {
        registerDefaultConverter( new BooleanConverter() );

        registerDefaultConverter( new ByteConverter() );

        registerDefaultConverter( new CharConverter() );
View Full Code Here

Examples of org.codehaus.plexus.component.configurator.converters.basic.BooleanConverter

    }


    private void registerDefaultBasicConverters()
    {
        registerDefaultConverter( new BooleanConverter() );

        registerDefaultConverter( new ByteConverter() );

        registerDefaultConverter( new CharConverter() );
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.BooleanConverter

        assertThat(list.get(2), equalTo(SomeEnum.THREE));
    }

    @Test
    public void shouldConvertBoolean() throws IntrospectionException {
        ParameterConverter converter = new BooleanConverter();
        assertThat(converter.accept(Boolean.TYPE), equalTo(true));
        assertThat(converter.accept(Boolean.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithBoolean").getGenericParameterTypes()[0];
        assertThat((Boolean) converter.convertValue("true", type), is(true));
        assertThat((Boolean) converter.convertValue("false", type), is(false));
        assertThat((Boolean) converter.convertValue("whatever", type), is(false));
    }
View Full Code Here

Examples of org.jbehave.core.steps.ParameterConverters.BooleanConverter

        assertThat((Boolean) converter.convertValue("whatever", type), is(false));
    }

    @Test
    public void shouldConvertBooleanWithCustomValues() throws IntrospectionException {
        ParameterConverter converter = new BooleanConverter("ON", "OFF");
        assertThat(converter.accept(Boolean.TYPE), equalTo(true));
        assertThat(converter.accept(Boolean.class), equalTo(true));
        assertThat(converter.accept(WrongType.class), is(false));
        assertThat(converter.accept(mock(Type.class)), is(false));
        Type type = SomeSteps.methodFor("aMethodWithBoolean").getGenericParameterTypes()[0];
        assertThat((Boolean) converter.convertValue("ON", type), is(true));
        assertThat((Boolean) converter.convertValue("OFF", type), is(false));
        assertThat((Boolean) converter.convertValue("whatever", type), is(false));
    }
View Full Code Here

Examples of org.jboss.forge.shell.command.convert.BooleanConverter

   @Inject
   private IgnoreEofKeyListener ignoreEOF;

   void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
   {
      BooleanConverter booleanConverter = new BooleanConverter();

      addConversionHandler(boolean.class, booleanConverter);
      addConversionHandler(Boolean.class, booleanConverter);
      addConversionHandler(File.class, new FileConverter());
      addConversionHandler(Dependency.class, new DependencyIdConverter());
View Full Code Here

Examples of org.jboss.forge.shell.command.convert.BooleanConverter

   @Inject
   private IgnoreEofKeyListener ignoreEOF;

   void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
   {
      BooleanConverter booleanConverter = new BooleanConverter();

      addConversionHandler(boolean.class, booleanConverter);
      addConversionHandler(Boolean.class, booleanConverter);
      addConversionHandler(File.class, new FileConverter());
      addConversionHandler(Dependency.class, new DependencyIdConverter());
View Full Code Here

Examples of org.jboss.forge.shell.command.convert.BooleanConverter

   @Inject
   private ShellConfig shellConfig;

   void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
   {
      BooleanConverter booleanConverter = new BooleanConverter();

      addConversionHandler(boolean.class, booleanConverter);
      addConversionHandler(Boolean.class, booleanConverter);
      addConversionHandler(File.class, new FileConverter());
      addConversionHandler(Dependency.class, new DependencyIdConverter());
View Full Code Here

Examples of org.jboss.forge.shell.command.convert.BooleanConverter

   @Inject
   private Instance<TriggeredAction> triggeredActions;

   void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
   {
      BooleanConverter booleanConverter = new BooleanConverter();

      addConversionHandler(boolean.class, booleanConverter);
      addConversionHandler(Boolean.class, booleanConverter);
      addConversionHandler(File.class, new FileConverter());
      addConversionHandler(Dependency.class, new DependencyIdConverter());
View Full Code Here

Examples of org.jboss.forge.shell.command.convert.BooleanConverter

   @Inject
   private IgnoreEofKeyListener ignoreEOF;

   void init(@Observes final Startup event, final PluginCommandCompleter pluginCompleter) throws Exception
   {
      BooleanConverter booleanConverter = new BooleanConverter();

      addConversionHandler(boolean.class, booleanConverter);
      addConversionHandler(Boolean.class, booleanConverter);
      addConversionHandler(File.class, new FileConverter());
      addConversionHandler(Dependency.class, new DependencyIdConverter());
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.