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


Java VisibleForTesting类代码示例

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


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


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