Examples of AlwaysTrueCondition


Examples of games.stendhal.server.entity.npc.condition.AlwaysTrueCondition

   * a chat condition that checks whether transactions are possible at all
   *
   * @return ChatCondition
   */
  public ChatCondition getTransactionCondition() {
    return new AlwaysTrueCondition();
  }
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AlwaysTrueCondition

  public final void testIsConditionFulfilled() {
    Transition t = new Transition(someconst, Arrays.asList(ConversationParser.createTriggerExpression("trigger")), null, false, idle_0, null, null);
    assertTrue(t.isConditionFulfilled(PlayerTestHelper.createPlayer("player"),
        null, SpeakerNPCTestHelper.createSpeakerNPC()));
    t = new Transition(someconst, Arrays.asList(ConversationParser.createTriggerExpression("trigger")),
        new AlwaysTrueCondition(), false, idle_0, null, null);
    assertTrue(t.isConditionFulfilled(PlayerTestHelper.createPlayer("player"),
        null, SpeakerNPCTestHelper.createSpeakerNPC()));
    t = new Transition(someconst, Arrays.asList(ConversationParser.createTriggerExpression("trigger")),
        new NotCondition(new AlwaysTrueCondition()), false, idle_0, null, null);
    assertFalse(t.isConditionFulfilled(PlayerTestHelper.createPlayer("player"),
        null, SpeakerNPCTestHelper.createSpeakerNPC()));
  }
View Full Code Here

Examples of games.stendhal.server.entity.npc.condition.AlwaysTrueCondition

    setRPClass("gate");
    put("type", "gate");
    setOrientation(orientation);
    setOpen(false);
    if (condition == null) {
      condition = new AlwaysTrueCondition();
    }
    this.condition = condition;
    if (image != null) {
      put(IMAGE, image);
    } else {
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

        ruleControl1.expectAndReturn(rule1.getErrorCode(), "errorCode1");
        ruleControl1.expectAndReturn(rule1.getDefaultErrorMessage(), "message1");
        ruleControl1.expectAndReturn(rule1.getErrorArguments(object), args);

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] globalRules = new ValidationRule[] { rule1, rule2 };
        configurationControl.expectAndReturn(configuration.getGlobalRules(), globalRules);

        converterControl.expectAndReturn(converter.convertGlobalErrorCode("errorCode1", Object.class), "_errorCode1");
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

    public void testValidateAndShortCircuitRules_WhenOnlyTheSecondFails() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        Object[] args = new Object[0];
        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysFalseCondition());
        ruleControl2.expectAndReturn(rule2.getErrorCode(), "errorCode2");
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

    public void testValidateAndShortCircuitRules_WhenNoneFail() throws Exception {
        Object object = new Object();

        ruleControl1.expectAndReturn(rule1.isApplicable(object), true);
        ruleControl1.expectAndReturn(rule1.getCondition(), new AlwaysTrueCondition());

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] rules = new ValidationRule[] { rule1, rule2 };

        replay();
        validator.validateAndShortCircuitRules(rules, "name", object, errors);
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

     */
    protected AbstractValidationRule(String defaultErrorCode, ErrorArgumentsResolver defaultErrorArgumentsResolver) {
        this.errorCode = defaultErrorCode;
        this.defaultErrorMessage = this.errorCode;
        this.errorArgumentsResolver = defaultErrorArgumentsResolver;
        this.applicabilityCondition = new AlwaysTrueCondition();
    }
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

     * Constructs a new CascadeValidation with a given property name. This cascading always applies.
     *
     * @param propertyName The name of the property to which the validation will be cascaded.
     */
    public CascadeValidation(String propertyName) {
        this(propertyName, new AlwaysTrueCondition());
    }
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

        }
        if (!StringUtils.hasText(argsString)) {
            argsString = "";
        }
        ErrorArgumentsResolver argsResolver = buildErrorArgumentsResolver(argsString);
        Condition applyIfCondition = new AlwaysTrueCondition();
        if (StringUtils.hasText(applyIfString)) {
            applyIfCondition = conditionExpressionParser.parse(applyIfString);
        }

        String[] contexts = null;
View Full Code Here

Examples of org.springmodules.validation.util.condition.common.AlwaysTrueCondition

        ruleControl1.expectAndReturn(rule1.getErrorCode(), "errorCode1");
        ruleControl1.expectAndReturn(rule1.getDefaultErrorMessage(), "message1");
        ruleControl1.expectAndReturn(rule1.getErrorArguments(object), args);

        ruleControl2.expectAndReturn(rule2.isApplicable(object), true);
        ruleControl2.expectAndReturn(rule2.getCondition(), new AlwaysTrueCondition());

        ValidationRule[] globalRules = new ValidationRule[]{rule1, rule2};
        configurationControl.expectAndReturn(configuration.getGlobalRules(), globalRules);

        converterControl.expectAndReturn(converter.convertGlobalErrorCode("errorCode1", Object.class), "_errorCode1");
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.