org.assertj.core.api.AbstractFileAssert.usingCharset()方法的使用及代码示例

x33g5p2x  于11个月前 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(45)

本文整理了Java中org.assertj.core.api.AbstractFileAssert.usingCharset()方法的一些代码示例,展示了AbstractFileAssert.usingCharset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractFileAssert.usingCharset()方法的具体详情如下:
包路径:org.assertj.core.api.AbstractFileAssert
类名称:AbstractFileAssert
方法名:usingCharset

AbstractFileAssert.usingCharset介绍

[英]Specifies the name of the charset to use for text-based assertions on the file's contents.
[中]指定用于对文件内容进行基于文本的断言的字符集的名称。

代码示例

代码示例来源:origin: org.assertj/assertj-core

/**
 * Specifies the name of the charset to use for text-based assertions on the file's contents.
 *
 * @param charsetName the name of the charset to use.
 * @return {@code this} assertion object.
 * @throws IllegalArgumentException if the given encoding is not supported on this platform.
 */
@CheckReturnValue
public SELF usingCharset(String charsetName) {
 checkArgument(Charset.isSupported(charsetName), "Charset:<'%s'> is not supported on this system", charsetName);
 return usingCharset(Charset.forName(charsetName));
}

代码示例来源:origin: joel-costigliola/assertj-core

/**
 * Specifies the name of the charset to use for text-based assertions on the file's contents.
 *
 * @param charsetName the name of the charset to use.
 * @return {@code this} assertion object.
 * @throws IllegalArgumentException if the given encoding is not supported on this platform.
 */
@CheckReturnValue
public SELF usingCharset(String charsetName) {
 checkArgument(Charset.isSupported(charsetName), "Charset:<'%s'> is not supported on this system", charsetName);
 return usingCharset(Charset.forName(charsetName));
}

代码示例来源:origin: diffplug/spotless

public void hasContent(String expected, Charset charset) {
  Assertions.assertThat(file).usingCharset(charset).hasContent(expected);
}

代码示例来源:origin: org.assertj/assertj-core-java8

/**
 * Specifies the name of the charset to use for text-based assertions on the file's contents.
 * 
 * @param charsetName the name of the charset to use.
 * @return {@code this} assertion object.
 * @throws IllegalArgumentException if the given encoding is not supported on this platform.
 */
public S usingCharset(String charsetName) {
 if (!Charset.isSupported(charsetName))
  throw new IllegalArgumentException(String.format("Charset:<'%s'> is not supported on this system", charsetName));
 return usingCharset(Charset.forName(charsetName));
}

代码示例来源:origin: airlift/drift

private static void assertGenerated(File basedir, String name)
      throws IOException
  {
    URL expected = getResource(format("basic/%s.txt", name));

    name += META_SUFFIX;
    assertThat(new File(basedir, format("target/classes/its/%s.class", name))).isFile();
    assertThat(new File(basedir, format("target/generated-sources/annotations/its/%s.java", name)))
        .usingCharset(UTF_8).hasContent(asCharSource(expected, UTF_8).read());
  }
}

相关文章