Package org.spockframework.util

Examples of org.spockframework.util.InternalSpockError


      case SETUP_SPEC:
      case CLEANUP_SPEC:
      case SPEC_EXECUTION:
        return END_SPEC;
      default:
        throw new InternalSpockError("unknown method kind");
    }
  }
View Full Code Here


        currentInstance = sharedInstance;
      } else {
        currentInstance = (Specification) spec.getReflection().newInstance();
      }
    } catch (Throwable t) {
      throw new InternalSpockError("Failed to instantiate spec '%s'", t).withArgs(spec.getName());
    }

    getSpecificationContext().setCurrentSpec(spec);
    getSpecificationContext().setSharedInstance(sharedInstance);
  }
View Full Code Here

    // only fall back to renderer for type Object once all other options have been exhausted
    IObjectRenderer renderer = renderers.get(Object.class);
    if (renderer != null) return renderer.render(object);

    throw new InternalSpockError("no renderer for type Object found");
  }
View Full Code Here

  public boolean isEmpty() {
    return current == null;
  }

  public Object respond(IMockInvocation invocation) {
    if (isEmpty()) throw new InternalSpockError("ResultGeneratorChain should never be empty");
   
    while (current.isAtEndOfCycle() && !remaining.isEmpty()) {
      current = remaining.removeFirst();
    }
    return current.respond(invocation);
View Full Code Here

      messageWriter = new OutputStreamWriter(messageBuffer, "utf-8");
      JsonWriter jsonWriter = new JsonWriter(messageWriter);
      jsonWriter.write(log);
      messageWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(messageWriter);
    }

    ByteArrayOutputStream sizeBuffer = new ByteArrayOutputStream();
    Writer sizeWriter = null;
    try {
      sizeWriter = new OutputStreamWriter(sizeBuffer, "utf-8");
      sizeWriter.write(String.valueOf(messageBuffer.size()));
      sizeWriter.write("\n");
    } catch (IOException e) {
      throw new InternalSpockError(e);
    } finally {
      IoUtil.closeQuietly(sizeWriter);
    }

    try {
View Full Code Here

      if (factory.canCreate(configuration)) {
        return factory.create(configuration, specification);
      }
    }

    throw new InternalSpockError("No matching mock factory found");
  }
View Full Code Here

  private void initializeConfigurations(List<?> initialConfigurations) {
    for (Object configuration : initialConfigurations) {
      ConfigurationObject annotation = configuration.getClass().getAnnotation(ConfigurationObject.class);
      if (annotation == null) {
        throw new InternalSpockError("Not a @ConfigurationObject: %s").withArgs(configuration.getClass());
      }
      configurationsByType.put(configuration.getClass(), configuration);
      configurationsByName.put(annotation.value(), configuration);
    }
  }
View Full Code Here

TOP

Related Classes of org.spockframework.util.InternalSpockError

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.