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

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

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

AbstractFileAssert.isNull介绍

暂无

代码示例

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

@Test
 public void return_null_when_no_file_source() {
  assertThat(underTest.readFileSource(UNKNOWN_COMPONENT_REF)).isNull();
 }
}

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

@Test
 public void should_stop_and_clean_temp_dir() {
  File tempDir = cachesManager.tempDir();
  assertThat(tempDir).isDirectory().exists();
  assertThat(cachesManager.persistit()).isNotNull();
  assertThat(cachesManager.persistit().isInitialized()).isTrue();

  cachesManager.stop();

  assertThat(tempDir).doesNotExist();
  assertThat(cachesManager.tempDir()).isNull();
  assertThat(cachesManager.persistit()).isNull();
 }
}

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

@Test
public void working_directory() {
 Command command = Command.create("java");
 assertThat(command.getDirectory()).isNull();
 File working = new File("working");
 command = Command.create("java").setDirectory(working);
 assertThat(command.getDirectory()).isEqualTo(working);
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void getPath() {
  BreakpointInfo info = new BreakpointInfo(0, "", new File(""), null);
  assertThat(info.getFile()).isNull();
  final String parentPath = "/sdcard";
  final String filename = "abc";
  info = new BreakpointInfo(0, "", new File(parentPath), filename);
  assertThat(info.getFile()).isEqualTo(new File(parentPath, filename));
}

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

@Test
public void shouldLoadServerProperties() {
 Settings settings = new MapSettings();
 settings.setProperty(CoreProperties.SERVER_ID, "123");
 settings.setProperty(CoreProperties.SERVER_STARTTIME, "2010-05-18T17:59:00+0000");
 ScannerWsClient client = mock(ScannerWsClient.class);
 when(client.baseUrl()).thenReturn("http://foo.com");
 DefaultServer metadata = new DefaultServer(((MapSettings) settings).asConfig(), client, SonarRuntimeImpl.forSonarQube(Version.parse("2.2"), SonarQubeSide.SCANNER));
 assertThat(metadata.getId()).isEqualTo("123");
 assertThat(metadata.getVersion()).isEqualTo("2.2");
 assertThat(metadata.getStartedAt()).isNotNull();
 assertThat(metadata.getURL()).isEqualTo("http://foo.com");
 assertThat(metadata.getPermanentServerId()).isEqualTo("123");
 assertThat(metadata.getRootDir()).isNull();
 assertThat(metadata.getContextPath()).isNull();
 assertThat(metadata.isDev()).isFalse();
 assertThat(metadata.isSecured()).isFalse();
}

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

@Test
public void should_not_skip_report_for_unchanged_files_in_short_branch() {
 // sanity check, normally report gets generated
 AnalysisResult result = getResult(tester);
 assertThat(getResult(tester).getReportComponent(result.inputFile(FILE_PATH))).isNotNull();
 int fileId = 2;
 assertThat(result.getReportReader().readChangesets(fileId)).isNotNull();
 assertThat(result.getReportReader().hasCoverage(fileId)).isTrue();
 assertThat(result.getReportReader().readFileSource(fileId)).isNotNull();
 // file is not skipped for short branches (need coverage, duplications coming soon)
 AnalysisResult result2 = getResult(tester.setBranchType(BranchType.SHORT));
 assertThat(result2.getReportComponent(result2.inputFile(FILE_PATH))).isNotNull();
 assertThat(result2.getReportReader().readChangesets(fileId)).isNull();
 assertThat(result2.getReportReader().hasCoverage(fileId)).isTrue();
 assertThat(result2.getReportReader().readFileSource(fileId)).isNull();
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void createFinder() {
  DownloadTask task = StatusUtil.createFinder(url, file.getParent(), null);
  assertThat(task.getFile()).isNull();
  assertFile(task.getParentFile()).isEqualTo(file.getParentFile());
  task = StatusUtil.createFinder(url, file.getParent(), file.getName());
  assertFile(task.getFile()).isEqualTo(file);
}

代码示例来源:origin: lingochamp/okdownload

@Test
public void taskBuilder_constructWithFile() {
  final String url = "https://jacksgong.com";
  final File noExistFile = new File(parentPath, "no-exist");
  DownloadTask task = new DownloadTask.Builder(url, noExistFile).build();
  assertThat(task.getFilename()).isEqualTo(noExistFile.getName());
  assertThat(task.getFile().getAbsolutePath()).isEqualTo(noExistFile.getAbsolutePath());
  final File existFile = new File(parentPath, filename);
  task = new DownloadTask.Builder(url, existFile).build();
  assertThat(task.getFilename()).isEqualTo(existFile.getName());
  assertThat(task.getFile().getAbsolutePath()).isEqualTo(existFile.getAbsolutePath());
  final File existParentFile = new File(parentPath);
  task = new DownloadTask.Builder(url, existParentFile).build();
  assertThat(task.getFilename()).isNull();
  assertThat(task.getFile()).isNull();
  assertFile(task.getParentFile()).isEqualTo(existParentFile);
  final File onlyFile = new File("/path");
  task = new DownloadTask.Builder(url, onlyFile).build();
  assertThat(task.getFilename()).isEqualTo("path");
  assertFile(task.getFile()).isEqualTo(onlyFile);
  assertFile(task.getParentFile()).isEqualTo(new File("/"));
}

代码示例来源:origin: lingochamp/okdownload

.build();
assertThat(task.getFilename()).isNull();
assertThat(task.getFile()).isNull();
assertFile(task.getParentFile()).isEqualTo(new File(parentPath));
    .build();
assertThat(task.getFilename()).isNull();
assertThat(task.getFile()).isNull();
assertFile(task.getParentFile()).isEqualTo(new File(parentPath));
    .build();
assertThat(task.getFilename()).isNull();
assertThat(task.getFile()).isNull();
assertFile(task.getParentFile()).isEqualTo(new File("not-exist"));
    .build();
assertThat(task.getFilename()).isNull();
assertThat(task.getFile()).isNull();
assertFile(task.getParentFile()).isEqualTo(new File("not-exist"));
    .build();
assertThat(task.getFilename()).isNull();
assertThat(task.getFile()).isNull();
assertFile(task.getParentFile()).isEqualTo(new File("not-exist"));

代码示例来源:origin: zanata/zanata-platform

@Test
public void willBackupExistingProjectConfig() throws Exception {
  ConsoleInteractor console =
      MockConsoleInteractor.predefineAnswers("y");
  InitOptions opts = new InitOptionsImpl();
  ProjectConfigHandler handler = new ProjectConfigHandler(console, opts);
  File projectConfig = tempFolder.newFile("zanata.xml");
  opts.setProjectConfig(projectConfig);
  handler.handleExistingProjectConfig();
  List<String> capturedPrompts =
      MockConsoleInteractor.getCapturedPrompts(console);
  String lastMessage = capturedPrompts.get(capturedPrompts.size() - 1);
  assertThat(lastMessage).contains("Old project config has been renamed to ");
  String backupPath =
      lastMessage.replace("Old project config has been renamed to ", "");
  assertThat(new File(backupPath).exists()).isTrue();
  assertThat(opts.getProj()).isNull();
  assertThat(opts.getProjectVersion()).isNull();
  assertThat(opts.getProjectType()).isNull();
  assertThat(opts.getProjectConfig()).isNull();
  assertThat(opts.getSrcDir()).isNull();
  assertThat(opts.getTransDir()).isNull();
  assertThat(opts.getIncludes()).isEmpty();
  assertThat(opts.getExcludes()).isEmpty();
}

代码示例来源:origin: spring-projects/spring-integration-aws

@Test
public void testUploadByteArray() throws IOException {
  byte[] payload = "b".getBytes("UTF-8");
  Message<?> message = MessageBuilder.withPayload(payload)
      .setHeader("s3Command", S3MessageHandler.Command.UPLOAD.name())
      .setHeader("key", "myStream")
      .build();
  this.s3SendChannel.send(message);
  ArgumentCaptor<PutObjectRequest> putObjectRequestArgumentCaptor =
      ArgumentCaptor.forClass(PutObjectRequest.class);
  verify(this.amazonS3, atLeastOnce()).putObject(putObjectRequestArgumentCaptor.capture());
  PutObjectRequest putObjectRequest = putObjectRequestArgumentCaptor.getValue();
  assertThat(putObjectRequest.getBucketName()).isEqualTo(S3_BUCKET_NAME);
  assertThat(putObjectRequest.getKey()).isEqualTo("myStream");
  assertThat(putObjectRequest.getFile()).isNull();
  assertThat(putObjectRequest.getInputStream()).isNotNull();
  ObjectMetadata metadata = putObjectRequest.getMetadata();
  assertThat(metadata.getContentMD5()).isEqualTo(Md5Utils.md5AsBase64(payload));
  assertThat(metadata.getContentLength()).isEqualTo(1);
  assertThat(metadata.getContentType()).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
  assertThat(metadata.getContentDisposition()).isEqualTo("test.json");
}

代码示例来源:origin: spring-projects/spring-integration-aws

@Test
public void testUploadInputStream() throws IOException {
  Expression actualKeyExpression = TestUtils.getPropertyValue(this.s3MessageHandler, "keyExpression",
      Expression.class);
  this.s3MessageHandler.setKeyExpression(null);
  InputStream payload = new StringInputStream("a");
  Message<?> message = MessageBuilder.withPayload(payload)
      .setHeader("s3Command", S3MessageHandler.Command.UPLOAD.name())
      .setHeader("key", "myStream")
      .build();
  assertThatThrownBy(() -> this.s3SendChannel.send(message))
      .hasCauseExactlyInstanceOf(IllegalStateException.class)
      .hasMessageContaining("Specify a 'keyExpression' for non-java.io.File payloads");
  this.s3MessageHandler.setKeyExpression(actualKeyExpression);
  this.s3SendChannel.send(message);
  ArgumentCaptor<PutObjectRequest> putObjectRequestArgumentCaptor =
      ArgumentCaptor.forClass(PutObjectRequest.class);
  verify(this.amazonS3, atLeastOnce()).putObject(putObjectRequestArgumentCaptor.capture());
  PutObjectRequest putObjectRequest = putObjectRequestArgumentCaptor.getValue();
  assertThat(putObjectRequest.getBucketName()).isEqualTo(S3_BUCKET_NAME);
  assertThat(putObjectRequest.getKey()).isEqualTo("myStream");
  assertThat(putObjectRequest.getFile()).isNull();
  assertThat(putObjectRequest.getInputStream()).isNotNull();
  ObjectMetadata metadata = putObjectRequest.getMetadata();
  assertThat(metadata.getContentMD5()).isEqualTo(Md5Utils.md5AsBase64(payload));
  assertThat(metadata.getContentLength()).isEqualTo(1);
  assertThat(metadata.getContentType()).isEqualTo(MediaType.APPLICATION_JSON_VALUE);
  assertThat(metadata.getContentDisposition()).isEqualTo("test.json");
}

代码示例来源:origin: SonarSource/sonar-php

@Test
public void should_have_correct_context() {
 ActionParser<Tree> parser = PHPParserBuilder.createParser();
 PhpFile file = FileTestUtils.getFile(new File("src/test/resources/visitors/test.php"));
 CompilationUnitTree tree = (CompilationUnitTree) parser.parse(file.contents());
 ContextTestVisitor testVisitor = new ContextTestVisitor();
 testVisitor.analyze(file, tree);
 assertThat(testVisitor.context().getPhpFile()).isEqualTo(file);
 assertThat(testVisitor.context().getWorkingDirectory()).isNull();
 File workingDir = new File("working_dir");
 testVisitor.analyze(new PHPCheckContext(file, tree, workingDir));
 assertThat(testVisitor.context().getWorkingDirectory()).isEqualTo(workingDir);
}

相关文章