• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StringSubject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



StringSubject类属于com.google.common.truth包,在下文中一共展示了StringSubject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: generatesTemplateThat

import com.google.common.truth.StringSubject; //导入依赖的package包/类
StringSubject generatesTemplateThat() {
  generateCode();
  if (fileNode.numChildren() != 1) {
    fail("expected to only have 1 template: " + fileNode.getChildren());
  }
  TemplateNode template = fileNode.getChild(0);
  // we know that 'file' contains exactly one template.  so find it.
  int functionIndex = file.indexOf("function(");
  int startOfFunction = file.substring(0, functionIndex).lastIndexOf('\n') + 1;
  int endOfFunction = file.lastIndexOf("}\n") + 2; // +2 to capture the \n

  // if it is a delegate function we want to include the registration code which is a single
  // statement after the end of the template
  if (template instanceof TemplateDelegateNode) {
    endOfFunction = file.indexOf(";\n", endOfFunction) + 2;
  }
  // if we are generating jsdoc we want to capture that too
  String templateBody;
    int startOfJsDoc = file.substring(0, startOfFunction).lastIndexOf("/**");
    templateBody = file.substring(startOfJsDoc, endOfFunction);
  return check()
      .withMessage("Unexpected template body generated for %s:", actual())
      .that(templateBody);
}
 
开发者ID:google,项目名称:closure-templates,代码行数:25,代码来源:JsSrcSubject.java


示例2: testToString

import com.google.common.truth.StringSubject; //导入依赖的package包/类
@Test
void testToString() {
	Error objectUnderTest = new Error();
	objectUnderTest.setSourceIdentifier("sourceID");
	objectUnderTest.setDetails(Collections.singletonList(Detail.forErrorCode(ErrorCode.UNEXPECTED_ERROR)));
	objectUnderTest.setType("aType");
	objectUnderTest.setMessage("coolMessage");

	StringSubject subject = assertWithMessage("Must contain formatted string")
			.that(objectUnderTest.toString());
	subject.contains(String.valueOf(objectUnderTest.getSourceIdentifier()));
	subject.contains(String.valueOf(objectUnderTest.getDetails()));
	subject.contains(String.valueOf(objectUnderTest.getType()));
	subject.contains(String.valueOf(objectUnderTest.getMessage()));
}
 
开发者ID:CMSgov,项目名称:qpp-conversion-tool,代码行数:16,代码来源:ErrorTest.java


示例3: is_used_as_default_applicationClass

import com.google.common.truth.StringSubject; //导入依赖的package包/类
@Test public void is_used_as_default_applicationClass() throws Exception {
  project.named("test").buildWithArguments("assemble");
  
  Execution original = ExecutableJar.at(project.file("build/libs/test.jar")).run();
  Execution capsule = CapsuleJar.at(project.file("build/libs/test-capsule.jar")).run();
  
  assertThat(original).succeeded();
  StringSubject capsuleOutput = assertThat(capsule).succeededAnd().standardOutput();
  capsuleOutput.isNotEmpty();
  capsuleOutput.isEqualTo(original.output);
}
 
开发者ID:jonas-l,项目名称:gradle-capsule-plugin,代码行数:12,代码来源:DeclaredJarMainClassManifestEntry.java


示例4: hasLogAtLevelWithMessage

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public Which<StringSubject> hasLogAtLevelWithMessage(Level level, String message) {
  List<String> messagesAtLevel = getMessagesAtLevel(level);
  check()
      .withMessage("Logs at level %s", level)
      .that(messagesAtLevel)
      .comparingElementsUsing(CONTAINS_CORRESPONDENCE)
      .contains(message);
  for (String messageCandidate : messagesAtLevel) {
    if (messageCandidate.contains(message)) {
      return new Which<>(assertThat(messageCandidate)
          .named(String.format("log message at %s matching '%s'", level, message)));
    }
  }
  throw new AssertionError("Message check passed yet matching message not found");
}
 
开发者ID:google,项目名称:nomulus,代码行数:16,代码来源:LogsSubject.java


示例5: textSymbolFile

import com.google.common.truth.StringSubject; //导入依赖的package包/类
@NonNull
public StringSubject textSymbolFile() throws IOException {
    InputStream stream = getInputStream("R.txt");

    return new StringSubject(failureStrategy,
            CharStreams.toString(new InputStreamReader(stream, Charsets.UTF_8)));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AarSubject.java


示例6: asString

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject asString() throws IOException {
  isNotNull();
  // We shouldn't close the BinaryResult within this method as it might still
  // be used afterwards. Besides, closing it doesn't have an effect for most
  // implementations of a BinaryResult.
  BinaryResult binaryResult = actual();
  return Truth.assertThat(binaryResult.asString());
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:BinaryResultSubject.java


示例7: checkTopic

import com.google.common.truth.StringSubject; //导入依赖的package包/类
private void checkTopic(Result change, @Nullable String topic) throws RestApiException {
  ChangeInfo info = gApi.changes().id(change.getChangeId()).get();
  StringSubject t = assertThat(info.topic).named("topic");
  if (topic != null) {
    t.isEqualTo(topic);
  } else {
    t.isNull();
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:CorsIT.java


示例8: assertThatSourceString

import com.google.common.truth.StringSubject; //导入依赖的package包/类
private static StringSubject assertThatSourceString(TemplateNode node) {
  SoyFileNode parent = node.getParent().copy(new CopyState());
  new DesugarHtmlNodesPass().run(parent, new IncrementingIdGenerator());
  StringBuilder sb = new StringBuilder();
  parent.getChild(0).appendSourceStringForChildren(sb);
  return assertThat(sb.toString());
}
 
开发者ID:google,项目名称:closure-templates,代码行数:8,代码来源:HtmlRewritePassTest.java


示例9: contentsAsString

import com.google.common.truth.StringSubject; //导入依赖的package包/类
/**
 * Returns a {@link StringSubject} that makes assertions about the contents of the actual file as
 * a string.
 */
public StringSubject contentsAsString(Charset charset) {
  try {
    return check()
        .that(JavaFileObjects.asByteSource(actual()).asCharSource(charset).read())
        .named("the contents of " + actualAsString());
  } catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:google,项目名称:compile-testing,代码行数:14,代码来源:JavaFileObjectSubject.java


示例10: standardError

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject standardError() {
  return Truth.assertThat(actual().error);
}
 
开发者ID:jonas-l,项目名称:gradle-capsule-plugin,代码行数:4,代码来源:ExecutionSubject.java


示例11: standardOutput

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject standardOutput() {
  return Truth.assertThat(actual().output);
}
 
开发者ID:jonas-l,项目名称:gradle-capsule-plugin,代码行数:4,代码来源:ExecutionSubject.java


示例12: assertThat

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public static StringSubject assertThat(@Nullable String target) {
    return assert_().that(target);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:TruthHelper.java


示例13: diagnosticStream

import com.google.common.truth.StringSubject; //导入依赖的package包/类
StringSubject diagnosticStream() {
  String[] parseResult = parse();
  return assertThat(parseResult[1]);
}
 
开发者ID:angular,项目名称:clutz,代码行数:5,代码来源:ProgramSubject.java


示例14: commonLines

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public ListSubject<StringSubject, String> commonLines() {
  isNotNull();
  ContentEntry contentEntry = actual();
  return ListSubject.assertThat(contentEntry.ab, Truth::assertThat).named("common lines");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ContentEntrySubject.java


示例15: linesOfA

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public ListSubject<StringSubject, String> linesOfA() {
  isNotNull();
  ContentEntry contentEntry = actual();
  return ListSubject.assertThat(contentEntry.a, Truth::assertThat).named("lines of 'a'");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ContentEntrySubject.java


示例16: linesOfB

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public ListSubject<StringSubject, String> linesOfB() {
  isNotNull();
  ContentEntry contentEntry = actual();
  return ListSubject.assertThat(contentEntry.b, Truth::assertThat).named("lines of 'b'");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:ContentEntrySubject.java


示例17: path

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject path() {
  return Truth.assertThat(actual().path).named("path");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:FixReplacementInfoSubject.java


示例18: replacement

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject replacement() {
  return Truth.assertThat(actual().replacement).named("replacement");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:4,代码来源:FixReplacementInfoSubject.java


示例19: baseRevision

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject baseRevision() {
  isNotNull();
  EditInfo editInfo = actual();
  return Truth.assertThat(editInfo.baseRevision).named("baseRevision");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:EditInfoSubject.java


示例20: commit

import com.google.common.truth.StringSubject; //导入依赖的package包/类
public StringSubject commit() {
  isNotNull();
  CommitInfo commitInfo = actual();
  return Truth.assertThat(commitInfo.commit).named("commit");
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:6,代码来源:CommitInfoSubject.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiplexingGcmListener类代码示例发布时间:2022-05-23
下一篇:
Java DisplayText类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap