本文整理汇总了Java中org.assertj.core.util.VisibleForTesting类的典型用法代码示例。如果您正苦于以下问题:Java VisibleForTesting类的具体用法?Java VisibleForTesting怎么用?Java VisibleForTesting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VisibleForTesting类属于org.assertj.core.util包,在下文中一共展示了VisibleForTesting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: parse
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
/**
* Thread safe utility method to parse a FDate with {@link #userDateFormats} first, then
* {@link #DEFAULT_DATE_FORMATS}.
* <p>
* Returns <code>null</code> if dateAsString parameter is <code>null</code>.
*
* @param dateAsString
* the string to parse as a FDate with {@link #userDateFormats}
* @return the corresponding FDate, null if dateAsString parameter is null.
* @throws AssertionError
* if the string can't be parsed as a FDate
*/
@VisibleForTesting
FDate parse(final String dateAsString) {
if (dateAsString == null) {
return null;
}
// parse with date format specified by user if any, otherwise use default formats
// no synchronization needed as userCustomDateFormat is thread local
FDate date = parseFDateWith(dateAsString, userDateFormats.get());
if (date != null) {
return date;
}
// no matching user date format, let's try default format
date = parseFDateWithDefaultDateFormats(dateAsString);
if (date != null) {
return date;
}
// no matching date format, throw an error
throw new AssertionError("Failed to parse " + dateAsString + " with any of these date formats: "
+ info.representation().toStringOf(dateFormatsInOrderOfUsage()));
}
开发者ID:subes,项目名称:invesdwin-util,代码行数:33,代码来源:FDateAssert.java
示例2: doParse
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected GetAliasesResponse doParse(BytesReference bytesReference) {
try (XContentParser parser = XContentHelper.createParser(bytesReference)) {
ListMultimap<String, AliasMetaData> metaDatas = ArrayListMultimap.create();
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == START_OBJECT) {
if (currentFieldName != null) { // we are at an index metadata start
List<AliasMetaData> aliasMetaDatas = parseAliases(parser);
metaDatas.putAll(currentFieldName, aliasMetaDatas);
}
}
}
Map<String, List<AliasMetaData>> map = Multimaps.asMap(metaDatas);
aliases = ImmutableOpenMap.<String, List<AliasMetaData>>builder().putAll(map).build();
return this;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:25,代码来源:GetAliasesResponse.java
示例3: parseAliases
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected static List<AliasMetaData> parseAliases(XContentParser parser) {
assert parser.currentToken() == START_OBJECT;
try {
List<AliasMetaData> result = new ArrayList<>();
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token == START_OBJECT) {
if ("aliases".equals(currentFieldName)) {
while (parser.nextToken() != XContentParser.Token.END_OBJECT) {
AliasMetaData metaData = parseAlias(parser);
result.add(metaData);
}
}
}
}
return result;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:25,代码来源:GetAliasesResponse.java
示例4: diff
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
public BinaryDiffResult diff(Path actual, byte[] expected) throws IOException {
InputStream expectedStream = new ByteArrayInputStream(expected);
InputStream actualStream = null;
boolean threw = true;
try {
actualStream = Files.newInputStream(actual);
BinaryDiffResult result = diff(actualStream, expectedStream);
threw = false;
return result;
} finally {
try {
if (actualStream != null) actualStream.close();
} catch (IOException e) {
// Only rethrow if it doesn't shadow an exception thrown from the inner try block
if (!threw) throw e;
}
}
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:20,代码来源:BinaryDiff.java
示例5: customize
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
void customize(Undertow.Builder builder) {
builder
.setServerOption(UndertowOptions.ENABLE_HTTP2, true)
.setServerOption(UndertowOptions.HTTP2_SETTINGS_ENABLE_PUSH, true)
.addHttpListener(httpPort, "0.0.0.0");
}
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:8,代码来源:Application.java
示例6: jettyServerPush
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
/**
* Create a PushBuilder for the given request an perform a push.
*
* @param request the request from which to get the PushBuilder
*/
@VisibleForTesting
void jettyServerPush(ServletRequest request) {
org.eclipse.jetty.server.PushBuilder jettyPushBuilder = Request
.getBaseRequest(request)
.getPushBuilder();
jettyPushBuilder
.path("/push-greeting?name=push")
.push();
}
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:15,代码来源:JettyServerPushFunction.java
示例7: createDefaultArtifactBinding
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected HTTPArtifactBinding createDefaultArtifactBinding(ServiceProviderBuilder builder) {
HttpClientParams params = new HttpClientParams();
params.setIntParameter(HttpConnectionParams.CONNECTION_TIMEOUT, 60000);
HttpClient httpClient = new HttpClient(params, new MultiThreadedHttpConnectionManager());
ArtifactResolutionProfileImpl artifactResolutionProfile = new ArtifactResolutionProfileImpl(httpClient);
builder.setSharedObject(ArtifactResolutionProfile.class, artifactResolutionProfile);
HTTPSOAP11Binding soapBinding = new HTTPSOAP11Binding(parserPool);
artifactResolutionProfile.setProcessor(new SAMLProcessorImpl(soapBinding));
return new HTTPArtifactBinding(parserPool, getVelocityEngine(), artifactResolutionProfile);
}
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:12,代码来源:SAMLProcessorConfigurer.java
示例8: getComparator
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@Override
@VisibleForTesting
public Comparator<?> getComparator() {
if (comparisonStrategy instanceof ComparatorBasedComparisonStrategy) {
return ((ComparatorBasedComparisonStrategy) comparisonStrategy).getComparator();
}
return null;
}
开发者ID:subes,项目名称:invesdwin-util,代码行数:9,代码来源:FDatesAssertions.java
示例9: parseAlias
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected static AliasMetaData parseAlias(XContentParser parser) {
assert parser.currentToken() == FIELD_NAME : "expected a FIELD_NAME token but was " + parser.currentToken();
try {
return AliasMetaData.Builder.fromXContent(parser);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:10,代码来源:GetAliasesResponse.java
示例10: doParse
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected BulkResponse doParse(BytesReference bytesReference) {
try (XContentParser parser = XContentHelper.createParser(bytesReference)) {
List<BulkItem> items = new ArrayList<>();
this.items = items;
XContentParser.Token token;
String currentFieldName = null;
while ((token = parser.nextToken()) != XContentParser.Token.END_OBJECT) {
if (token == XContentParser.Token.FIELD_NAME) {
currentFieldName = parser.currentName();
} else if (token.isValue()) {
if ("took".equals(currentFieldName)) {
took = parser.longValue();
} else if ("errors".equals(currentFieldName)) {
errors = parser.booleanValue();
}
} else if (token == XContentParser.Token.START_ARRAY) {
parser.nextToken();
if ("items".equals(currentFieldName)) {
while (parser.currentToken() != XContentParser.Token.END_ARRAY) {
BulkItem bulkItem = new BulkItem().parse(parser);
items.add(bulkItem);
}
}
}
}
return this;
} catch (IOException e) {
throw new RuntimeException(e);
}
}
开发者ID:obourgain,项目名称:elasticsearch-http,代码行数:33,代码来源:BulkResponse.java
示例11:
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
ShouldBeEqual(Object actual, Object expected, ComparisonStrategy comparisonStrategy, Representation representation) {
this.actual = actual;
this.expected = expected;
this.comparisonStrategy = comparisonStrategy;
this.representation = representation;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:ShouldBeEqual.java
示例12: parse
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
/**
* Thread safe utility method to parse a Date with {@link #userDateFormats} first, then {@link #DEFAULT_DATE_FORMATS}.
* <p>
* Returns <code>null</code> if dateAsString parameter is <code>null</code>.
*
* @param dateAsString the string to parse as a Date with {@link #userDateFormats}
* @return the corresponding Date, null if dateAsString parameter is null.
* @throws AssertionError if the string can't be parsed as a Date
*/
@VisibleForTesting
Date parse(String dateAsString) {
if (dateAsString == null) return null;
// parse with date format specified by user if any, otherwise use default formats
// no synchronization needed as userCustomDateFormat is thread local
Date date = parseDateWith(dateAsString, userDateFormats.get());
if (date != null) return date;
// no matching user date format, let's try default format
date = parseDateWithDefaultDateFormats(dateAsString);
if (date != null) return date;
// no matching date format, throw an error
throw new AssertionError(String.format("Failed to parse %s with any of these date formats:%n %s", dateAsString,
info.representation().toStringOf(dateFormatsInOrderOfUsage())));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:24,代码来源:AbstractDateAssert.java
示例13: getComparator
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
public Comparator<?> getComparator() {
if (comparisonStrategy instanceof ComparatorBasedComparisonStrategy) {
return ((ComparatorBasedComparisonStrategy) comparisonStrategy).getComparator();
}
return null;
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:8,代码来源:Iterables.java
示例14: assertContains
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
public void assertContains(AssertionInfo info, Failures failures, Object actual, Object values) {
if (commonChecks(info, actual, values)) return;
Set<Object> notFound = new LinkedHashSet<>();
int valueCount = sizeOf(values);
for (int i = 0; i < valueCount; i++) {
Object value = Array.get(values, i);
if (!arrayContains(actual, value)) notFound.add(value);
}
if (!notFound.isEmpty())
throw failures.failure(info, shouldContain(actual, values, notFound, comparisonStrategy));
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:13,代码来源:Arrays.java
示例15: class_soft_assertions_should_report_errors_on_final_methods
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void class_soft_assertions_should_report_errors_on_final_methods() {
// GIVEN
Class<AnnotatedClass> actual = AnnotatedClass.class;
// WHEN
softly.assertThat(actual)
.hasAnnotations(MyAnnotation.class, AnotherAnnotation.class)
.hasAnnotations(SafeVarargs.class, VisibleForTesting.class);
// THEN
List<Throwable> errorsCollected = softly.errorsCollected();
assertThat(errorsCollected).hasSize(1);
assertThat(errorsCollected.get(0)).hasMessageContaining("SafeVarargs")
.hasMessageContaining("VisibleForTesting");
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:16,代码来源:SoftAssertionsTest.java
示例16: class_soft_assertions_should_report_errors_on_final_methods
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void class_soft_assertions_should_report_errors_on_final_methods() {
// GIVEN
Class<AnnotatedClass> actual = AnnotatedClass.class;
// WHEN
softly.then(actual)
.hasAnnotations(MyAnnotation.class, AnotherAnnotation.class)
.hasAnnotations(SafeVarargs.class, VisibleForTesting.class);
// THEN
List<Throwable> errorsCollected = softly.errorsCollected();
assertThat(errorsCollected).hasSize(1);
assertThat(errorsCollected.get(0)).hasMessageContaining("SafeVarargs")
.hasMessageContaining("VisibleForTesting");
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:16,代码来源:BDDSoftAssertionsTest.java
示例17: provideAssumptionsRunners
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Parameters
public static Object[][] provideAssumptionsRunners() {
return new AssumptionRunner[][] {
run(AnnotatedClass.class,
value -> assumeThat(value).hasAnnotations(MyAnnotation.class, AnotherAnnotation.class),
value -> assumeThat(value).hasAnnotations(SafeVarargs.class, VisibleForTesting.class))
};
}
开发者ID:joel-costigliola,项目名称:assertj-core,代码行数:10,代码来源:Class_final_method_assertions_in_assumptions_Test.java
示例18: configureServerForHttp2
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
/**
* Configure the http2 server.
*
* @param server the server
* @return the server
*/
@VisibleForTesting
Server configureServerForHttp2(Server server) {
// HTTP Configuration
HttpConfiguration http11Config = new HttpConfiguration();
http11Config.setSecureScheme("https");
http11Config.setSecurePort(httpsPort);
// SSL Context Factory for HTTPS and HTTP/2
SslContextFactory sslContextFactory = new SslContextFactory();
sslContextFactory.setKeyStoreResource(newClassPathResource("sample.jks"));
sslContextFactory.setKeyStorePassword("secret");
sslContextFactory.setKeyManagerPassword("secret");
sslContextFactory.setCipherComparator(HTTP2Cipher.COMPARATOR);
sslContextFactory.setUseCipherSuitesOrder(true);
// HTTPS Configuration
HttpConfiguration httpsConfig = new HttpConfiguration(http11Config);
httpsConfig.addCustomizer(new SecureRequestCustomizer());
// HTTP/2 Connection Factory
HTTP2ServerConnectionFactory h2 = new HTTP2ServerConnectionFactory(httpsConfig);
NegotiatingServerConnectionFactory.checkProtocolNegotiationAvailable();
ALPNServerConnectionFactory alpnServerConnectionFactory = new ALPNServerConnectionFactory();
alpnServerConnectionFactory.setDefaultProtocol("h2");
alpnServerConnectionFactory.getALPNProcessor();
// SSL Connection Factory
SslConnectionFactory sslConnectionFactory =
new SslConnectionFactory(sslContextFactory,
alpnServerConnectionFactory.getProtocol());
// HTTP/2 Connector
ServerConnector http2Connector =
new ServerConnector(server, sslConnectionFactory, alpnServerConnectionFactory, h2,
new HttpConnectionFactory(httpsConfig));
http2Connector.setPort(httpPort);
server.addConnector(http2Connector);
return server;
}
开发者ID:janweinschenker,项目名称:servlet4-demo,代码行数:48,代码来源:ApplicationConfig.java
示例19: setPropertyKeysPickup
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected static void setPropertyKeysPickup(PropertyKeysPickup propertyKeysPickup) {
PropertiesToJsonParser.propertyKeysPickup = propertyKeysPickup;
}
开发者ID:mikolajmitura,项目名称:java-properties-to-json,代码行数:5,代码来源:PropertiesToJsonParser.java
示例20: createDefaultSamlContextProvider
import org.assertj.core.util.VisibleForTesting; //导入依赖的package包/类
@VisibleForTesting
protected SAMLContextProvider createDefaultSamlContextProvider() {
return new SAMLContextProviderImpl();
}
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:5,代码来源:SAMLContextProviderConfigurer.java
注:本文中的org.assertj.core.util.VisibleForTesting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论