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

x33g5p2x  于2022-01-15 转载在 其他  
字(5.1k)|赞(0)|评价(0)|浏览(104)

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

AbstractFileAssert.isSameAs介绍

暂无

代码示例

代码示例来源:origin: SonarSource/sonarqube

@Test
 public void getDirectory_returns_File_set_with_setDirectory() {
  File file = new File("");
  BatchReportDirectoryHolderImpl holder = new BatchReportDirectoryHolderImpl();
  holder.setDirectory(file);

  assertThat(holder.getDirectory()).isSameAs(file);
 }
}

代码示例来源:origin: SonarSource/sonarqube

@Test
 public void add_part() throws IOException {
  PostRequest request = new PostRequest("api/issues/search");
  File reportFile = temp.newFile();
  request.setPart("report", new PostRequest.Part(MediaTypes.JSON, reportFile));

  assertThat(request.getParts()).hasSize(1);
  PostRequest.Part part = request.getParts().get("report");
  assertThat(part.getMediaType()).isEqualTo(MediaTypes.JSON);
  assertThat(part.getFile()).isSameAs(reportFile);
 }
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void test_command_with_complete_information() throws Exception {
 File workDir = temp.newFolder();
 JavaCommand<JvmOptions> command = new JavaCommand<>(ProcessId.ELASTICSEARCH, workDir);
 command.setArgument("first_arg", "val1");
 Properties args = new Properties();
 args.setProperty("second_arg", "val2");
 command.setArguments(args);
 command.setClassName("org.sonar.ElasticSearch");
 command.setEnvVariable("JAVA_COMMAND_TEST", "1000");
 command.addClasspath("lib/*.jar");
 command.addClasspath("conf/*.xml");
 JvmOptions<JvmOptions> jvmOptions = new JvmOptions<JvmOptions>() {};
 command.setJvmOptions(jvmOptions);
 assertThat(command.toString()).isNotNull();
 assertThat(command.getClasspath()).containsOnly("lib/*.jar", "conf/*.xml");
 assertThat(command.getJvmOptions()).isSameAs(jvmOptions);
 assertThat(command.getWorkDir()).isSameAs(workDir);
 assertThat(command.getClassName()).isEqualTo("org.sonar.ElasticSearch");
 // copy current env variables
 assertThat(command.getEnvVariables().get("JAVA_COMMAND_TEST")).isEqualTo("1000");
 assertThat(command.getEnvVariables().size()).isEqualTo(System.getenv().size() + 1);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void unzip_plugin_without_libs() throws Exception {
 File jarFile = temp.newFile();
 final File toDir = temp.newFolder();
 PluginInfo pluginInfo = new PluginInfo("foo").setJarFile(jarFile);
 PluginJarExploder exploder = new PluginJarExploder() {
  @Override
  public ExplodedPlugin explode(PluginInfo info) {
   return explodeFromUnzippedDir("foo", info.getNonNullJarFile(), toDir);
  }
 };
 ExplodedPlugin exploded = exploder.explode(pluginInfo);
 assertThat(exploded.getKey()).isEqualTo("foo");
 assertThat(exploded.getLibs()).isEmpty();
 assertThat(exploded.getMain()).isSameAs(jarFile);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void unzip_plugin_with_libs() throws Exception {
 final File jarFile = getFile("sonar-checkstyle-plugin-2.8.jar");
 final File toDir = temp.newFolder();
 PluginInfo pluginInfo = new PluginInfo("checkstyle").setJarFile(jarFile);
 PluginJarExploder exploder = new PluginJarExploder() {
  @Override
  public ExplodedPlugin explode(PluginInfo info) {
   try {
    ZipUtils.unzip(jarFile, toDir, newLibFilter());
    return explodeFromUnzippedDir(info.getKey(), info.getNonNullJarFile(), toDir);
   } catch (Exception e) {
    throw new IllegalStateException(e);
   }
  }
 };
 ExplodedPlugin exploded = exploder.explode(pluginInfo);
 assertThat(exploded.getKey()).isEqualTo("checkstyle");
 assertThat(exploded.getLibs()).extracting("name").containsOnly("antlr-2.7.6.jar", "checkstyle-5.1.jar", "commons-cli-1.0.jar");
 assertThat(exploded.getMain()).isSameAs(jarFile);
}

代码示例来源:origin: SonarSource/sonarqube

@Test
public void create_from_minimal_manifest() throws Exception {
 PluginManifest manifest = new PluginManifest();
 manifest.setKey("java");
 manifest.setVersion("1.0");
 manifest.setName("Java");
 manifest.setMainClass("org.foo.FooPlugin");
 File jarFile = temp.newFile();
 PluginInfo pluginInfo = PluginInfo.create(jarFile, manifest);
 assertThat(pluginInfo.getKey()).isEqualTo("java");
 assertThat(pluginInfo.getName()).isEqualTo("Java");
 assertThat(pluginInfo.getVersion().getName()).isEqualTo("1.0");
 assertThat(pluginInfo.getJarFile()).isSameAs(jarFile);
 assertThat(pluginInfo.getMainClass()).isEqualTo("org.foo.FooPlugin");
 assertThat(pluginInfo.getBasePlugin()).isNull();
 assertThat(pluginInfo.getDescription()).isNull();
 assertThat(pluginInfo.getHomepageUrl()).isNull();
 assertThat(pluginInfo.getImplementationBuild()).isNull();
 assertThat(pluginInfo.getIssueTrackerUrl()).isNull();
 assertThat(pluginInfo.getLicense()).isNull();
 assertThat(pluginInfo.getOrganizationName()).isNull();
 assertThat(pluginInfo.getOrganizationUrl()).isNull();
 assertThat(pluginInfo.getMinimalSqVersion()).isNull();
 assertThat(pluginInfo.getRequiredPlugins()).isEmpty();
 assertThat(pluginInfo.isSonarLintSupported()).isFalse();
}

相关文章