Package fitnesse.slim

Examples of fitnesse.slim.SlimError


  private static String getWord(List<Object> words, int word) {
    try {
      return (String) words.get(word);
    } catch (Exception e) {
      throw new SlimError(format("message:<<%s %s.>>", SlimServer.MALFORMED_INSTRUCTION, wordsToString(words)));
    }
  }
View Full Code Here


    Integer[] integers = new Integer[strings.length];
    for (int i = 0; i < strings.length; i++) {
      try {
        integers[i] = Integer.parseInt(strings[i]);
      } catch (NumberFormatException e) {
        throw new SlimError("message:<<CANT_CONVERT_TO_INTEGER_LIST>>");
      }
    }
    return integers;
  }
View Full Code Here

  public Date fromString(String arg) {
    try {
      return dateFormat.parse(arg);
    } catch (ParseException e) {
      throw new SlimError("Can't parse date " + arg, e);
    }
  }
View Full Code Here

    Double[] doubles = new Double[strings.length];
    for (int i = 0; i < strings.length; i++) {
      try {
        doubles[i] = Double.parseDouble(strings[i]);
      } catch (NumberFormatException e) {
        throw new SlimError("message:<<CANT_CONVERT_TO_DOUBLE_LIST>>");
      }
    }
    return doubles;
  }
View Full Code Here

    Boolean[] booleans = new Boolean[strings.length];
    for (int i = 0; i < strings.length; i++) {
      try {
        booleans[i] = booleanConverter.fromString(strings[i]);
      } catch (NumberFormatException e) {
        throw new SlimError("message:<<CANT_CONVERT_TO_BOOLEAN_LIST>>");
      }
    }
    return booleans;
  }
View Full Code Here

    String html = pageToTest.getHtml();
    Parser parser = new Parser(new Lexer(new Page(html)));
    try {
      return parser.parse(null);
    } catch (ParserException e) {
      throw new SlimError(e);
    }
  }
View Full Code Here

    NodeList htmlTree;
    try {
      Parser parser = new Parser(new Lexer(new Page(page)));
      htmlTree = parser.parse(null);
    } catch (ParserException e) {
      throw new SlimError(e);
    }
    scanForTables(htmlTree);
  }
View Full Code Here

  }

  private void checkForVersionMismatch() {
    double serverVersionNumber = getServerVersion();
    if (serverVersionNumber == NO_SLIM_SERVER_CONNECTION_FLAG) {
      throw new SlimError("Slim Protocol Version Error: Server did not respond with a valid version number.");
    }
    else if (serverVersionNumber < requiredSlimVersion) {
      throw new SlimError(String.format("Slim Protocol Version Error: Expected V%s but was V%s", requiredSlimVersion, serverVersionNumber));
    }
  }
View Full Code Here

  private Socket tryConnect(int maxTries) throws IOException {
    try {
      return new Socket(hostName, port);
    } catch (IOException e) {
      if (maxTries <= 1) {
        throw new SlimError("Error connecting to SLiM server on " + hostName + ":" + port, e);
      } else {
        try {
          Thread.sleep(50);
        } catch (InterruptedException i) {
          throw new SlimError("Wait for connection interrupted.");
        }
        return null;
      }
    }
  }
View Full Code Here

        }

        @Override
        public void assign(String symbolName, Object value) {
          if (slimServerVersion < 0.4) {
            throw new SlimError("The assign instruction is available as of SLIM protocol version 0.4");
          }
          Object[] list = new Object[] { instruction.getId(), AssignInstruction.INSTRUCTION, symbolName, value };
          statementsAsList.add(asList(list));
        }
      };
View Full Code Here

TOP

Related Classes of fitnesse.slim.SlimError

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.