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


Java Assert.assertNull方法代码示例

本文整理汇总了Java中org.testng.Assert.assertNull方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.assertNull方法的具体用法?Java Assert.assertNull怎么用?Java Assert.assertNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.testng.Assert的用法示例。


在下文中一共展示了Assert.assertNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSerializationNullData

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testSerializationNullData() {
    GroupDataSummary summary = new GroupDataSummary();
    summary.setData(null);

    byte[] serialized = summary.toByteArray();
    Assert.assertNotNull(serialized);

    Memory memory = new NativeMemory(serialized);

    byte initializedByte = memory.getByte(GroupDataSummary.INITIALIZED_POSITION);
    int length = memory.getInt(GroupDataSummary.SIZE_POSITION);
    byte[] dataSerialized = new byte[length];
    memory.getByteArray(GroupDataSummary.DATA_POSITION, dataSerialized, 0, length);
    CachingGroupData data = SerializerDeserializer.fromBytes(dataSerialized);

    Assert.assertTrue(initializedByte == 0);
    Assert.assertTrue(length > 0);
    Assert.assertNull(data);
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:21,代码来源:GroupDataSummaryTest.java

示例2: testRequestNoneActiveIntermediate

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testRequestNoneActiveIntermediate() {
    final AuthenticationContext authCtx = prc.getSubcontext(AuthenticationContext.class);
    authCtx.getIntermediateFlows().put("test2", authCtx.getPotentialFlows().get("test2"));
    final List<Principal> principals = Arrays.<Principal> asList(new TestPrincipal("test3"), new TestPrincipal(
            "test2"));
    final RequestedPrincipalContext rpc = new RequestedPrincipalContext();
    rpc.getPrincipalEvalPredicateFactoryRegistry().register(TestPrincipal.class, "exact",
            new ExactPrincipalEvalPredicateFactory());
    rpc.setOperator("exact");
    rpc.setRequestedPrincipals(principals);
    authCtx.addSubcontext(rpc, true);
    authCtx.getPotentialFlows().get("test2").setSupportedPrincipals(principals);
    authCtx.getPotentialFlows().get("test3").setSupportedPrincipals(principals);

    action.execute(src);

    Assert.assertNull(authCtx.getAuthenticationResult());
    Assert.assertEquals(authCtx.getAttemptedFlow().getId(), "test3");
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:21,代码来源:SelectAuthenticationFlowTest.java

示例3: folderRecursiveOneFoundTest

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void folderRecursiveOneFoundTest() {
    FindFiles findFiles =  new FindFiles("resources", true).setIncludeFiles(false).setIncludeFolders(true);
    TUExecutionResult executionResult = findFiles.execution(transformedAppFolder, transformationContext);
    Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.VALUE);
    Assert.assertNotNull(executionResult.getValue());

    List<File> files = (List<File>) executionResult.getValue();
    Assert.assertEquals(files.size(), 1);

    Assert.assertTrue(files.contains(new File(transformedAppFolder, "/src/main/resources")));
    Assert.assertEquals(findFiles.getNameRegex(), "resources");
    Assert.assertNull(findFiles.getPathRegex());
    Assert.assertTrue(findFiles.isRecursive());
    Assert.assertFalse(findFiles.isIncludeFiles());
    Assert.assertTrue(findFiles.isIncludeFolders());
    Assert.assertEquals(findFiles.getDescription(), "Find files whose name and/or path match regular expression and are under the root folder and sub-folders");
    Assert.assertNull(executionResult.getException());
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:20,代码来源:FindFilesTest.java

示例4: testMatchPolicyWithNoTargetAction

import org.testng.Assert; //导入方法依赖的package包/类
/**
 * Tests matching a blanket policy to a request.
 *
 * @throws IOException
 *             on failure to load policy required for test.
 */
public void testMatchPolicyWithNoTargetAction() throws IOException {
    File file = getPolicyFileForTest(getMethodName());
    PolicySet policySet = PolicySets.loadFromFile(file);
    List<Policy> policies = policySet.getPolicies();

    PolicyMatchCandidate candidate = new PolicyMatchCandidate();
    candidate.setAction("GET");
    candidate.setResourceURI("/this/does/not/exist");
    candidate.setSubjectIdentifier("Edward R. Murrow");
    candidate.setSupplementalResourceAttributes(Collections.emptySet());
    candidate.setSupplementalSubjectAttributes(Collections.emptySet());
    List<MatchedPolicy> matchedPolicies = this.policyMatcher.match(candidate, policies);
    Assert.assertEquals(matchedPolicies.size(), 1);
    Assert.assertEquals(matchedPolicies.get(0).getPolicy(), policies.get(policies.size() - 1));
    Assert.assertNull(matchedPolicies.get(0).getPolicy().getTarget());
}
 
开发者ID:eclipse,项目名称:keti,代码行数:23,代码来源:PolicyMatcherImplTest.java

示例5: listTest

import org.testng.Assert; //导入方法依赖的package包/类
@Test(dependsOnMethods = "createTest")
public void listTest()
{
	ArrayNode all = institutions.list();

	boolean scratchyFound = false;
	boolean newFound = false;

	for( JsonNode inst : all )
	{
		if( "AutoTest".equals(inst.get("name").asText()) )
		{
			scratchyFound = true;
			Assert.assertEquals(inst.get("filestoreId").asText(), "autotest");
			Assert.assertTrue(inst.get("enabled").asBoolean());
			Assert.assertTrue(inst.get("url").asText().endsWith("/autotest/"));
			Assert.assertNull(inst.get("password"));
		}
		else if( INST_NAME.equals(inst.get("name").asText()) )
		{
			newFound = true;
			Assert.assertEquals(inst.get("filestoreId").asText(), INST_NAME);
			Assert.assertTrue(inst.get("enabled").asBoolean());
			Assert.assertTrue(inst.get("url").asText().endsWith("/" + INST_NAME + "/"));
			Assert.assertNull(inst.get("password"));
		}
		if( scratchyFound && newFound )
		{
			break;
		}
	}
	Assert.assertTrue(scratchyFound, "Scratchy not found");
	Assert.assertTrue(newFound, "New institution not found");
}
 
开发者ID:equella,项目名称:Equella,代码行数:35,代码来源:InstitutionApiTest.java

示例6: evalInvalidRegexTest

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void evalInvalidRegexTest() {
    RegexMatch regexMatch;
    TUExecutionResult executionResult;

    regexMatch = new RegexMatch().relative("/src/main/resources/dogs.yaml");
    regexMatch.setRegex("*Mustache*");
    executionResult = regexMatch.execution(transformedAppFolder, transformationContext);
    Assert.assertEquals(executionResult.getType(), TUExecutionResult.Type.ERROR);
    Assert.assertNull(executionResult.getValue());
    Assert.assertEquals(executionResult.getException().getClass(), PatternSyntaxException.class);
    Assert.assertEquals(executionResult.getException().getMessage(), "Dangling meta character '*' near index 0\n*Mustache*\n^");
}
 
开发者ID:paypal,项目名称:butterfly,代码行数:14,代码来源:RegexMatchTest.java

示例7: testMaxUnackedMessages

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testMaxUnackedMessages() throws PubSubException {
    String randomMessage = UUID.randomUUID().toString();
    String randomID = UUID.randomUUID().toString();

    KafkaConsumer<String, byte[]> consumer = makeMockConsumer(randomID, randomMessage);
    KafkaSubscriber subscriber = new KafkaSubscriber(consumer, 1);
    // Multiple receives without a commit.
    Assert.assertNotNull(subscriber.receive());
    Assert.assertNull(subscriber.receive());
}
 
开发者ID:yahoo,项目名称:bullet-kafka,代码行数:12,代码来源:KafkaSubscriberTest.java

示例8: testWeb

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testWeb() throws ComponentInitializationException {
    OIDCClientMetadata input = new OIDCClientMetadata();
    input.setApplicationType(ApplicationType.WEB);
    OIDCClientMetadata result = new OIDCClientMetadata();
    setUpContext(input, result);
    Assert.assertNull(action.execute(requestCtx));
    Assert.assertEquals(result.getApplicationType(), ApplicationType.WEB);
}
 
开发者ID:CSCfi,项目名称:shibboleth-idp-oidc-extension,代码行数:10,代码来源:AddApplicationTypeToClientMetadataTest.java

示例9: testUnimplementedStrategies

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testUnimplementedStrategies() {
    Aggregation aggregation = new Aggregation();
    aggregation.setType(null);
    aggregation.configure(new BulletConfig());

    Assert.assertNull(aggregation.getStrategy());
}
 
开发者ID:yahoo,项目名称:bullet-core,代码行数:9,代码来源:AggregationTest.java

示例10: testAddElementToNullNsNoDeclarations

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void testAddElementToNullNsNoDeclarations() throws Exception {
    // Create empty SOAP message
    SOAPMessage msg = createSoapMessage();
    SOAPBody body = msg.getSOAPPart().getEnvelope().getBody();

    // Add elements
    SOAPElement parentExplicitNS = body.addChildElement("content", "", TEST_NS);
    SOAPElement childGlobalNS = parentExplicitNS.addChildElement("global-child", "", null);
    SOAPElement childDefaultNS = parentExplicitNS.addChildElement("default-child");

    // Check namespace URIs
    Assert.assertNull(childGlobalNS.getNamespaceURI());
    Assert.assertEquals(childDefaultNS.getNamespaceURI(), TEST_NS);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:16,代码来源:SaajEmptyNamespaceTest.java

示例11: getProduct_should_return_null_if_product_is_not_set

import org.testng.Assert; //导入方法依赖的package包/类
@Test(groups = "StockConfig.getProduct")
public void getProduct_should_return_null_if_product_is_not_set()
        throws StockException {
    StockConfig config = new StockConfig();

    Assert.assertNull(config.getProduct());
}
 
开发者ID:adobe,项目名称:stock-api-sdk,代码行数:8,代码来源:StockConfigTest.java

示例12: getProductByDownloadableFilename

import org.testng.Assert; //导入方法依赖的package包/类
@Test
public void getProductByDownloadableFilename ()
{
   fr.gael.dhus.database.object.Collection validCollection;
   fr.gael.dhus.database.object.Collection invalidCollection;
   Product product;

   validCollection = new Collection ();
   validCollection.setUUID ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3");
   validCollection.setName ("Japan");

   invalidCollection = new Collection ();
   invalidCollection.setUUID ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4");
   invalidCollection.setName ("China");

   product = dao.getProductByDownloadableFilename("prod0",validCollection);
   Assert.assertNotNull(product);
   Assert.assertEquals(product.getId ().intValue(), 0);

   product = dao.getProductByDownloadableFilename("prod6",validCollection);
   Assert.assertNull(product);

   product = dao.getProductByDownloadableFilename("prod0",invalidCollection);
   Assert.assertNull (product);

   product = dao.getProductByDownloadableFilename("prod6",null);
   Assert.assertNotNull(product);
   Assert.assertEquals(product.getId ().intValue (), 6);

   product = dao.getProductByDownloadableFilename (null, null);
   Assert.assertNull (product);
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:33,代码来源:TestProductDao.java

示例13: assertViewerAndPreview

import org.testng.Assert; //导入方法依赖的package包/类
public void assertViewerAndPreview(JsonNode attachment, String viewer, boolean preview)
{
	JsonNode viewerNode = attachment.get("viewer");
	if( viewer == null )
	{
		Assert.assertNull(viewerNode);
	}
	else
	{
		Assert.assertEquals(viewerNode.asText(), viewer);
	}
	Assert.assertEquals(attachment.get("preview").asBoolean(), preview);
}
 
开发者ID:equella,项目名称:Equella,代码行数:14,代码来源:ApiAssertions.java

示例14: defaultUsageWithNullFallback

import org.testng.Assert; //导入方法依赖的package包/类
@Test(groups = "fast")
public void defaultUsageWithNullFallback() {
    // given
    List<InvoiceItem> items = setupDefaultInvoice(null, null, null, null, null);

    // when
    SimpleTaxDateResolver resolver = createResolver(new Properties());
    DateTime result = resolver.taxDateForInvoiceItem(tenantId, account, invoice, items.get(0),
            Collections.emptyList());

    // then
    Assert.assertNull(result,
            "Default resolves null when start/end/invoice/item created/invoice created dates mising");
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:15,代码来源:SimpleTaxDateResolverTests.java

示例15: delete

import org.testng.Assert; //导入方法依赖的package包/类
@Override
public void delete ()
{
   long id = 5;
   dao.delete (dao.read (id));
   Assert.assertEquals (dao.count (), (howMany () - 1));
   Assert.assertNull (dao.read (id));
   Assert.assertNotNull (udao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3"));
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:10,代码来源:TestNetworkUsageDao.java


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