Package com.googlecode.gwt.test.finder

Examples of com.googlecode.gwt.test.finder.Node$TokenException


      assertNotNull(processString("/toto(à)"));
      assertEquals("/toto(àéèê,)", processString("/toto(àéèê)").toString());
   }

   private Node processString(String s) {
      Node res = Node.parse(s);
      return res;
   }
View Full Code Here


   }

   @SuppressWarnings("unchecked")
   public <T> T getNodeValue(Object o, Node node) {
      Object current = o;
      Node currentNode = node;
      while (currentNode != null) {
         if (current == null) {
            return null;
         }
         String currentName = currentNode.getLabel();
         boolean mapEqIsProcessed = false;
         logger.trace(getProcessingMessagePrefix() + "Processing " + currentName);
         boolean ok = false;
         if (!ok) {
            Method m = GwtReflectionUtils.getMethod(current.getClass(), currentName);

            if (m == null) {
               m = GwtReflectionUtils.getMethod(current.getClass(), "get" + currentName);
            }
            if (m != null) {
               try {
                  if (m.getParameterTypes().length == 0 || currentNode.getParams() != null) {
                     current = invoke(current, m, currentNode.getParams());
                     ok = true;
                  } else {
                     current = findInList(current, m, currentNode.getMapEq(), currentNode.getMap());
                     mapEqIsProcessed = true;
                     ok = true;
                  }

               } catch (Exception e) {
                  logger.error(getAssertionErrorMessagePrefix() + "Execution error", e);
                  fail(getAssertionErrorMessagePrefix() + "Unable to get method result on "
                           + o.getClass().getCanonicalName() + ", method " + m.getName()
                           + ", params " + currentNode.getParams());
               }
            }
         }
         if (!ok) {
            Field f = getField(current, current.getClass(), currentName);
            if (f != null) {
               try {
                  current = f.get(current);
                  ok = true;
               } catch (Exception e) {
                  logger.error(getAssertionErrorMessagePrefix() + "Execution error", e);
                  fail(getAssertionErrorMessagePrefix() + "Unable to get field value on "
                           + o.getClass().getCanonicalName() + ", field " + f.getName()
                           + ", params " + node);
               }
            }
         }
         if (ok && currentNode.getMap() != null) {
            if (currentNode.getMapEq() == null) {
               current = proccessMap(current, currentNode.getMap());
            } else {
               if (!mapEqIsProcessed) {
                  if (current instanceof Iterable<?>) {
                     Iterable<Object> list = (Iterable<Object>) current;
                     current = findInIterable(list, currentNode.getMapEq(), currentNode.getMap(),
                              current, null);
                  } else {
                     fail(getAssertionErrorMessagePrefix() + "Not managed type for iteration "
                              + current.getClass().getCanonicalName());
                  }
               }
            }
         }
         if (!ok) {
            return null;
         }
         currentNode = currentNode.getNext();
      }

      return (T) current;
   }
View Full Code Here

TOP

Related Classes of com.googlecode.gwt.test.finder.Node$TokenException

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.