当前位置: 首页>>代码示例>>Java>>正文


Java SelfDescribing类代码示例

本文整理汇总了Java中org.hamcrest.SelfDescribing的典型用法代码示例。如果您正苦于以下问题:Java SelfDescribing类的具体用法?Java SelfDescribing怎么用?Java SelfDescribing使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


SelfDescribing类属于org.hamcrest包,在下文中一共展示了SelfDescribing类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: commandDescription

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private SelfDescribing commandDescription(final Command cmd) {
  return description -> {
    final String newLine = System.getProperty("line.separator");
    final List<String> logContents =
        logsOfInternalTests(cmd.getErrorLines()).collect(Collectors.toList());
    description
        .appendText("std-error:\n")
        .appendValueList("", newLine, newLine, cmd.getErrorLines());
    if (!logContents.isEmpty()) {
      description
          .appendText("Contents of internal test logs:\n")
          .appendText("*******************************\n")
          .appendValueList(newLine, newLine, newLine, logContents);
    }
  };
}
 
开发者ID:bazelbuild,项目名称:bazel-integration-testing,代码行数:17,代码来源:BazelBaseTestCaseTest.java

示例2: transformedBy

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
static <T,V> Matcher<? super Collection<T>> transformedBy(final Function<T, V> function, final Matcher<Collection<V>> underlying) {
    return new TypeSafeMatcher<Collection<T>>() {
        @Override
        protected boolean matchesSafely(final Collection<T> item) {
            return underlying.matches(
                    Lists.newArrayList(Iterables.transform(item, function)));
        }

        @Override
        public void describeTo(Description description) {
            description.appendText("transformed by ");
            if(function instanceof SelfDescribing) {
                SelfDescribing selfDescribingFunction = (SelfDescribing) function;
                description.appendDescriptionOf(selfDescribingFunction);
            } else {
                description.appendText("function ");
            }
            description.appendDescriptionOf(underlying);
        }
    };
}
 
开发者ID:isisaddons-legacy,项目名称:isis-module-security,代码行数:22,代码来源:ApplicationFeaturesIntegTest.java

示例3: describeTo

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
public void describeTo(Description description) {
    description.appendText("expected ");
    cardinality.describeExpected(description);
    description.appendText(", invoked ");
    cardinality.describeCount(description);
    description.appendText(": ");
    description.appendText(invocable.getName());
    description.appendList("(", ", ", ")", argMatchers);
    if (exceptionMatcher != null) {
        description.appendText(", expected to throw ");
        exceptionMatcher.describeTo(description);
    } else if (returnValueMatcher != null) {
        description.appendText(", expected to return ");
        returnValueMatcher.describeTo(description);
    }
    if (handler instanceof SelfDescribing) {
        description.appendText(" (will ");
        ((SelfDescribing) handler).describeTo(description);
        description.appendText(")");
    } else if (handler != null) {
        description.appendText(" (handled by ");
        description.appendValue(handler);
        description.appendText(")");
    }
}
 
开发者ID:pobrelkey,项目名称:moxiemocks,代码行数:26,代码来源:ExpectationImpl.java

示例4: describedWith

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private Iterable<SelfDescribing> describedWith(List<Expectation> expectations, final Invocation invocation) {
    final Iterator<Expectation> iterator = expectations.iterator();
    return new Iterable<SelfDescribing>() {
        public Iterator<SelfDescribing> iterator() {
            return new Iterator<SelfDescribing>() {
                public boolean hasNext() { return iterator.hasNext(); }
                public SelfDescribing next() {
                    return new SelfDescribing() {
                        public void describeTo(Description description) {
                            iterator.next().describeMismatch(invocation, description);
                        }
                    };
                }
                public void remove() { iterator.remove(); }
            };
        }
    };
}
 
开发者ID:Shared-Business-Service,项目名称:jMock-Demo,代码行数:19,代码来源:InvocationDispatcher.java

示例5: appendList

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
@Override
public Description appendList(String start, String separator, String end, Iterable<? extends SelfDescribing> values) {
    append(start);
    boolean first = true;
    for (SelfDescribing selfDescribing : values) {
        if (!first) {
            append(separator);
        } else {
            first = false;
        }
        selfDescribing.describeTo(this);
    }
    append(end);
    return this;
}
 
开发者ID:blipinsk,项目名称:cortado,代码行数:16,代码来源:RecordingDescription.java

示例6: withExtraTypeInfo

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
public SelfDescribing withExtraTypeInfo() {
    return new SelfDescribing() {
        @Override
        public void describeTo(final Description description) {
            description.appendText("(" + wanted.getClass().getSimpleName() + ") ").appendText(describe(wanted));
        }
    };
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:9,代码来源:HttpRequestMatcher.java

示例7: convertErrors

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private Iterable<SelfDescribing> convertErrors(final List<String> errors) {
    return errors.stream().map((it) -> {
        return new SelfDescribing() {
            @Override public void describeTo(final Description description) {
                description.appendText(it);
            }
        };
    }).collect(Collectors.toList());
}
 
开发者ID:mostlymagic,项目名称:hacking-java,代码行数:10,代码来源:AbstractCompilerTest.java

示例8: describe

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private void describe(Description description, Object value) {
	if (value instanceof SelfDescribing) {
		description.appendDescriptionOf((SelfDescribing) value);
	} else {
		description.appendValue(value);
	}
}
 
开发者ID:almondtools,项目名称:testrecorder,代码行数:8,代码来源:GenericMatcher.java

示例9: describe

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private List<SelfDescribing> describe(List<Method> conflicts) {
	List<SelfDescribing> descriptions = new ArrayList<SelfDescribing>(conflicts.size());
	for (Method conflict : conflicts) {
		descriptions.add(new Signature(methodSignature(conflict.getName(), conflict.getReturnType(), conflict.getParameterTypes(), conflict.getExceptionTypes())));
	}
	return descriptions;
}
 
开发者ID:almondtools,项目名称:xrayinterface,代码行数:8,代码来源:XRayMatcher.java

示例10: describe

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private List<SelfDescribing> describe(List<Method> conflicts) {
	List<SelfDescribing> descriptions = new ArrayList<SelfDescribing>(conflicts.size());
	for (Method conflict : conflicts) {
		StringBuilder buffer = new StringBuilder();
		buffer.append(conflict.getReturnType().getSimpleName());
		buffer.append(' ');
		buffer.append(conflict.getName());
		buffer.append('(');
		Class<?>[] parameterTypes = conflict.getParameterTypes();
		if (parameterTypes.length > 0) {
			buffer.append(parameterTypes[0].getSimpleName());
		}
		for (int i = 1; i < parameterTypes.length; i++) {
			buffer.append(", ");
			buffer.append(parameterTypes[i].getSimpleName());
		}
		buffer.append(')');
		Class<?>[] exceptionTypes = conflict.getExceptionTypes();
		if (exceptionTypes.length > 0) {
			buffer.append(" throws ");
			buffer.append(exceptionTypes[0].getSimpleName());
			for (int i = 1; i < exceptionTypes.length; i++) {
				buffer.append(", ");
				buffer.append(exceptionTypes[i].getSimpleName());
			}
		}
		descriptions.add(new Signature(buffer.toString()));
	}
	return descriptions ;
}
 
开发者ID:almondtools,项目名称:xrayinterface,代码行数:31,代码来源:ClassUnlockableMatcher.java

示例11: applyPrintSettings

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
private List<SelfDescribing> applyPrintSettings(List<Matcher> matchers, PrintSettings printSettings) {
    List<SelfDescribing> withPrintSettings = new LinkedList<SelfDescribing>();
    int i = 0;
    for (final Matcher matcher : matchers) {
        if (matcher instanceof ContainsExtraTypeInformation && printSettings.extraTypeInfoFor(i)) {
            withPrintSettings.add(((ContainsExtraTypeInformation) matcher).withExtraTypeInfo());
        } else {
            withPrintSettings.add(matcher);
        }
        i++;
    }
    return withPrintSettings;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:14,代码来源:MatchersPrinter.java

示例12: NotFoundNearestMatchersReducedListFilterResult

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
public NotFoundNearestMatchersReducedListFilterResult(
		SelfDescribing baseWithoutMatchers,
		CollectionOf<E> foundElements, 
		Description mismatchDescription) {
	super(foundElements, mismatchDescription);
	this.baseWithoutCurrentMatcher = baseWithoutMatchers;
}
 
开发者ID:jhc-systems,项目名称:redsniff,代码行数:8,代码来源:NotFoundNearestMatchersReducedListFilterResult.java

示例13: WithinSingleContextChecker

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
public WithinSingleContextChecker(ExpectationChecker<C0> parentChecker,
		SFinder<E0, C0> contextFinder, SelfDescribing parentContextDescription, String eachString) {
	super(null);
	this.contextFinder = contextFinder;
	this.parentContextDescription = parentContextDescription;
	this.eachString = eachString;
	this.parentChecker = parentChecker;
}
 
开发者ID:jhc-systems,项目名称:redsniff,代码行数:9,代码来源:WithinSingleContextChecker.java

示例14: WithinEachContextChecker

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
public WithinEachContextChecker(CollectionOf<C0> parentContexts,
		MFinder<E0, C0> contextFinder, SelfDescribing parentContextDescription, String eachString) {
	super(null);
	this.parentContexts = parentContexts;
	this.contextFinder = contextFinder;
	this.parentContextDescription = parentContextDescription;
	this.eachString = eachString;
}
 
开发者ID:jhc-systems,项目名称:redsniff,代码行数:9,代码来源:WithinEachContextChecker.java

示例15: describable

import org.hamcrest.SelfDescribing; //导入依赖的package包/类
@Override
public SelfDescribing describable(final Object thing) {
	return new SelfDescribing() {
		@Override
		public void describeTo(Description description) {
			description.appendText(thing.toString());
		}
	};
}
 
开发者ID:jhc-systems,项目名称:redsniff,代码行数:10,代码来源:ObjectDescribaliser.java


注:本文中的org.hamcrest.SelfDescribing类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。