org.junit.jupiter.api.Assertions#assertNotNull()源码实例Demo

下面列出了org.junit.jupiter.api.Assertions#assertNotNull() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: symbol-sdk-java   文件: JsonHelperGsonTest.java
@Test
public void shouldParsePrintedConvertObject() {
    Car car = new Car("Renault", "Scenic", 2005, OptionalInt.empty());
    String json = jsonHelper.print(car);

    Assertions.assertNotNull(json);
    Assertions.assertTrue(json.contains("Renault"));
    Assertions.assertFalse(json.contains("millage"));

    Object genericType = jsonHelper.parse(json);

    Car convertedType = jsonHelper.convert(genericType, Car.class);

    Assertions.assertEquals(car, convertedType);
    Assertions.assertEquals(BigInteger.valueOf(2005), convertedType.getYear());

}
 
源代码2 项目: symbol-sdk-java   文件: JsonHelperGsonTest.java
@Test
public void shouldParsePrintedObject() {
    Car car = new Car("Renault", "Scenic", 2005, OptionalInt.of(100));
    String json = jsonHelper.print(car);

    Assertions.assertNotNull(json);
    Assertions.assertTrue(json.contains("Renault"));
    Assertions.assertTrue(json.contains("\"millage\":100"));

    Car parsedCar = jsonHelper.parse(json, Car.class);
    Assertions.assertEquals(car, parsedCar);
    Assertions.assertEquals(BigInteger.valueOf(2005), parsedCar.getYear());
    Assertions.assertEquals(100, parsedCar.getMillage().getAsInt());

}
 
源代码3 项目: ck   文件: RealWorldClassesTest.java
@Test
public void greeterGrpc() {
	CKClassResult a = report.get("com.hry.spring.grpc.simple.GreeterGrpc");
	Assertions.assertNotNull(a);
	CKClassResult b = report.get("com.hry.spring.grpc.simple.GreeterGrpc$GreeterImplBase");
	Assertions.assertNotNull(b);

	Assertions.assertEquals(2, b.getNumberOfMethods());

	CKClassResult c = report.get("com.hry.spring.grpc.simple.GreeterGrpc$GreeterBlockingStub");
	Assertions.assertNotNull(c);
}
 
@Test
void getPictureStyleCaption() {
    final String expectedResult = "value";
    mockGetProperty(fakeImage, EdsPropertyID.kEdsPropID_PictureStyleCaption, expectedResult);

    final String result = spyPropertyGetShortcutLogic.getPictureStyleCaption(fakeImage);

    Assertions.assertNotNull(result);
    Assertions.assertEquals(expectedResult, result);
}
 
源代码5 项目: canon-sdk-java   文件: ShootLogicCameraTest.java
@Disabled("Only run manually")
@Test
void testShootWithShortcut() throws InterruptedException, ExecutionException {
    cameraObjectEventLogic().registerCameraObjectEvent(cameraRef);

    final CameraObjectListener cameraObjectListener = event -> {
        log.warn("Got event: {}", event);
    };
    cameraObjectEventLogic().addCameraObjectListener(cameraRef, cameraObjectListener);

    final CompletableFuture<List<File>> future = CompletableFuture.supplyAsync(() -> {
        try {
            return shootLogic().shoot(cameraRef);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    });

    getEvents();
    getEvents();
    getEvents();
    getEvents();

    final List<File> files = future.get();
    log.info("Files: {}", files);

    Assertions.assertNotNull(files);
    Assertions.assertTrue(files.size() > 0);
}
 
源代码6 项目: canon-sdk-java   文件: StructureTest.java
@Test
void test5() {
    final EdsFrameDesc eds1 = new EdsFrameDesc();
    final List<String> fieldOrder = eds1.getFieldOrder();
    Assertions.assertNotNull(fieldOrder);
    Assertions.assertFalse(fieldOrder.isEmpty());

    final EdsFrameDesc eds2 = new EdsFrameDesc(new Pointer(0));

    final EdsFrameDesc eds3 = new EdsFrameDesc(new NativeLong(0), new NativeLong(0),
        new NativeLong(0), new EdsRect(), new NativeLong(0));

    new EdsFrameDesc.ByReference();
    new EdsFrameDesc.ByValue();
}
 
源代码7 项目: commons-dbcp   文件: TestPoolingDriver.java
@Test
public void test1() {
    final ConnectionFactory connectionFactory = new DriverManagerConnectionFactory("jdbc:some:connect:string","userName","password");
    final PoolableConnectionFactory pcf =
        new PoolableConnectionFactory(connectionFactory, null);
    pcf.setDefaultReadOnly(Boolean.FALSE);
    pcf.setDefaultAutoCommit(Boolean.TRUE);
    final GenericObjectPool<PoolableConnection> connectionPool =
            new GenericObjectPool<>(pcf);
    pcf.setPool(connectionPool);
    final DataSource ds = new PoolingDataSource<>(connectionPool);
    Assertions.assertNotNull(ds);
}
 
源代码8 项目: apicurio-registry   文件: RegistryClientTest.java
@RegistryServiceTest
public void testSmoke(Supplier<RegistryService> supplier) {
    RegistryService service = supplier.get();

    service.deleteAllGlobalRules();

    Assertions.assertNotNull(service.toString());
    Assertions.assertEquals(service.hashCode(), service.hashCode());
    Assertions.assertEquals(service, service);
}
 
源代码9 项目: voj   文件: DiscussionReplyMapperTest.java
/**
 * 测试用例: 测试createDiscussionReply(DiscussionReply)方法.
 * 测试数据: 合法数据集
 * 预期结果: 数据插入操作成功完成
 */
@Test
public void testCreateDiscussionReplyNormally() {
	long threadId = 1;
	User creator = userMapper.getUserUsingUid(1000);
	Assertions.assertNotNull(creator);

	DiscussionReply discussionReply = new DiscussionReply(threadId, creator, "Content", "{}");
	int numberOfRowsAffected = discussionReplyMapper.createDiscussionReply(discussionReply);
	Assertions.assertEquals(1, numberOfRowsAffected);
}
 
源代码10 项目: platform   文件: ProxyServiceTests.java
@Test
public void test() {
    TestProxyService service = this.testProxyService.getInstance();
    System.out.println(service);
    System.out.println(this.testProxyService);
    Assertions.assertNotNull(service);
}
 
@Test
void getAEModeSelectDesc() {
    final List<EdsAEModeSelect> result = spyPropertyDescShortcutLogic.getAEModeSelectDesc(fakeCamera);

    Assertions.assertNotNull(result);

    verify(propertyDescLogic).getPropertyDesc(fakeCamera, EdsPropertyID.kEdsPropID_AEModeSelect);
}
 
源代码12 项目: alfresco-mvc   文件: InheritedServletConfigTest.java
@Test
public void when_alfrescoMvcDispatcherServletConfigOptionsWithSuffix_expect_suffixHandledAndOk() throws Exception {
	DispatcherServlet dispatcherServlet = dispatcherWebscript.getDispatcherServlet().getWebApplicationContext()
			.getBean(DispatcherServlet.class);
	Assertions.assertNotNull(dispatcherServlet);

	MockHttpServletResponse res = mockWebscript.withControllerMapping("/test/withsufix.test").execute();
	Assertions.assertEquals(HttpStatus.OK.value(), res.getStatus());

	String contentAsString = res.getContentAsString();
	Assertions.assertEquals("withsufix.test", contentAsString);

	System.out.println();
}
 
源代码13 项目: hyena   文件: TestPointLogDs.java
@Test
public void test_listPointLog4Page() {
    ListPointLogParam param = new ListPointLogParam();
    param.setUid(super.getUid()).setOrderNo("abcd123").setSk("abewfgewgewgewgewg")
            .setType(super.getPointType());
    ListResponse<PointLogDto> res = this.pointLogDs.listPointLog4Page(param);
    Assertions.assertNotNull(res);
}
 
@ParameterizedTest
@EnumSource(RepositoryType.class)
public void addAndRemoveTransactionRestriction(RepositoryType type) {

    AccountOperationRestrictionFlags restrictionFlags = AccountOperationRestrictionFlags.BLOCK_OUTGOING_TRANSACTION_TYPE;
    TransactionType transactionType = TransactionType.SECRET_PROOF;

    Account testAccount = getTestAccount();

    Assertions.assertNotNull(get(getRepositoryFactory(type).createAccountRepository()
        .getAccountInfo(testAccount.getAddress())));

    if (hasRestriction(type, testAccount, restrictionFlags, transactionType)) {
        System.out.println("Removing existing transaction restriction!");
        sendAccountRestrictionTransaction(type, transactionType, false, restrictionFlags);
        Assertions
            .assertFalse(hasRestriction(type, testAccount, restrictionFlags, transactionType));
    }

    System.out.println("Adding transaction restriction");
    sendAccountRestrictionTransaction(type, transactionType, true, restrictionFlags);

    Assertions.assertTrue(hasRestriction(type, testAccount, restrictionFlags, transactionType));

    System.out.println("Removing transaction restriction");
    sendAccountRestrictionTransaction(type, transactionType, false, restrictionFlags);

    Assertions
        .assertFalse(hasRestriction(type, testAccount, restrictionFlags, transactionType));

}
 
@Test
void getArtist() {
    final String expectedResult = "value";
    mockGetProperty(fakeCamera, EdsPropertyID.kEdsPropID_Artist, expectedResult);

    final String result = spyPropertyGetShortcutLogic.getArtist(fakeCamera);

    Assertions.assertNotNull(result);
    Assertions.assertEquals(expectedResult, result);
}
 
源代码16 项目: Slimefun4   文件: TestRecipeService.java
@Test
public void testSubscriptions() {
    MinecraftRecipeService service = new MinecraftRecipeService(plugin);
    AtomicReference<RecipeSnapshot> reference = new AtomicReference<>();

    Assertions.assertThrows(IllegalArgumentException.class, () -> service.subscribe(null));

    service.subscribe(reference::set);
    service.refresh();

    // The callback was executed
    Assertions.assertNotNull(reference.get());
}
 
源代码17 项目: quarkus   文件: UnremovableBeansTestCase.java
@Test
void unusedBeanWhoseProducerMarkedAsUnemoveableShouldBeAccessible() {
    Assertions.assertNotNull(Arc.container().instance(ProducerOfUnusedUnremovableBean.Bean.class).get());
}
 
@Test
public void shouldGetBlockByHeight() throws Exception {

    Address address = Address.generateRandom(networkType);
    BlockInfoDTO dto = new BlockInfoDTO();
    BlockMetaDTO metaDTO = new BlockMetaDTO();
    metaDTO.setHash("someHash");
    metaDTO.setNumTransactions(10);
    metaDTO.setGenerationHash("generationHash");
    metaDTO.setNumStatements(20);
    metaDTO.setStateHashSubCacheMerkleRoots(Arrays.asList("string1", "string2"));
    metaDTO.setTotalFee(BigInteger.valueOf(8L));

    dto.setMeta(metaDTO);

    BlockDTO blockDto = new BlockDTO();
    blockDto.setType(16716);
    blockDto.setSize(10L);
    blockDto.setVersion(3);
    blockDto.setSignerPublicKey("B630EFDDFADCC4A2077AB8F1EC846B08FEE2D2972EACF95BBAC6BFAC3D31834C");
    blockDto.setBeneficiaryAddress(address.encoded());
    blockDto.setHeight(BigInteger.valueOf(9L));

    blockDto.setNetwork(NetworkTypeEnum.NUMBER_144);
    dto.setBlock(blockDto);

    mockRemoteCall(dto);

    BigInteger height = BigInteger.valueOf(10L);
    BlockInfo info = repository.getBlockByHeight(height).toFuture().get();

    Assertions.assertNotNull(info);

    Assertions.assertEquals(blockDto.getBeneficiaryAddress(), info.getBeneficiaryAddress().encoded());

    Assertions.assertEquals(blockDto.getSignerPublicKey(), info.getSignerPublicAccount().getPublicKey().toHex());

    Assertions.assertEquals(16716, info.getType());
    Assertions.assertEquals(10, info.getSize());
    Assertions.assertEquals(3, info.getVersion().intValue());
    Assertions.assertEquals(NetworkType.MIJIN_TEST, info.getNetworkType());
    Assertions.assertEquals(BigInteger.valueOf(9L), info.getHeight());
    Assertions.assertEquals(metaDTO.getHash(), info.getHash());
    Assertions.assertEquals(metaDTO.getNumTransactions(), info.getNumTransactions());
    Assertions.assertEquals(metaDTO.getGenerationHash(), info.getGenerationHash());
    Assertions.assertEquals(metaDTO.getNumStatements(), info.getNumStatements().get());
    Assertions.assertEquals(metaDTO.getStateHashSubCacheMerkleRoots(), info.getSubCacheMerkleRoots());
    Assertions.assertEquals(metaDTO.getTotalFee(), info.getTotalFee());

    Assertions.assertEquals(blockDto.getHeight(), info.getHeight());
    Assertions.assertEquals(address, info.getBeneficiaryAddress());
    Assertions.assertEquals(10L, info.getSize());

}
 
源代码19 项目: ck   文件: BindingsTest.java
@Test
public void fullNameEvenWhenTypesAreNotAvailable() {
	CKClassResult a = report.get("bind.BindingFail1");
	Assertions.assertNotNull(a);
}
 
源代码20 项目: kafka-junit   文件: KafkaTestClusterTest.java
/**
 * Helper method to validate a KafkaBroker instance.
 * @param broker The KafkaBroker instance under test.
 * @param expectedBrokerId The expected brokerId.
 */
private void validateKafkaBroker(final KafkaBroker broker, final int expectedBrokerId) {
    Assertions.assertNotNull(broker);
    Assertions.assertEquals(expectedBrokerId, broker.getBrokerId());
}