Java Code Examples for org.junit.jupiter.api.Assertions#assertNotNull()
The following examples show how to use
org.junit.jupiter.api.Assertions#assertNotNull() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonHelperGsonTest.java From symbol-sdk-java with Apache License 2.0 | 6 votes |
@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()); }
Example 2
Source File: TestPoolingDriver.java From commons-dbcp with Apache License 2.0 | 5 votes |
@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); }
Example 3
Source File: TestRecipeService.java From Slimefun4 with GNU General Public License v3.0 | 5 votes |
@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()); }
Example 4
Source File: PropertyGetShortcutLogicDefaultMockTest.java From canon-sdk-java with MIT License | 5 votes |
@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); }
Example 5
Source File: AccountRestrictionIntegrationTest.java From symbol-sdk-java with Apache License 2.0 | 5 votes |
@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)); }
Example 6
Source File: TestPointLogDs.java From hyena with Apache License 2.0 | 5 votes |
@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); }
Example 7
Source File: InheritedServletConfigTest.java From alfresco-mvc with Apache License 2.0 | 5 votes |
@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(); }
Example 8
Source File: PropertyDescShortcutLogicDefaultMockTest.java From canon-sdk-java with MIT License | 5 votes |
@Test void getAEModeSelectDesc() { final List<EdsAEModeSelect> result = spyPropertyDescShortcutLogic.getAEModeSelectDesc(fakeCamera); Assertions.assertNotNull(result); verify(propertyDescLogic).getPropertyDesc(fakeCamera, EdsPropertyID.kEdsPropID_AEModeSelect); }
Example 9
Source File: ProxyServiceTests.java From platform with Apache License 2.0 | 5 votes |
@Test public void test() { TestProxyService service = this.testProxyService.getInstance(); System.out.println(service); System.out.println(this.testProxyService); Assertions.assertNotNull(service); }
Example 10
Source File: DiscussionReplyMapperTest.java From voj with GNU General Public License v3.0 | 5 votes |
/** * 测试用例: 测试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); }
Example 11
Source File: RegistryClientTest.java From apicurio-registry with Apache License 2.0 | 5 votes |
@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); }
Example 12
Source File: JsonHelperGsonTest.java From symbol-sdk-java with Apache License 2.0 | 5 votes |
@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()); }
Example 13
Source File: StructureTest.java From canon-sdk-java with MIT License | 5 votes |
@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(); }
Example 14
Source File: ShootLogicCameraTest.java From canon-sdk-java with MIT License | 5 votes |
@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); }
Example 15
Source File: PropertyGetShortcutLogicDefaultMockTest.java From canon-sdk-java with MIT License | 5 votes |
@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); }
Example 16
Source File: RealWorldClassesTest.java From ck with Apache License 2.0 | 5 votes |
@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); }
Example 17
Source File: BindingsTest.java From ck with Apache License 2.0 | 4 votes |
@Test public void fullNameEvenWhenTypesAreNotAvailable() { CKClassResult a = report.get("bind.BindingFail1"); Assertions.assertNotNull(a); }
Example 18
Source File: BlockRepositoryOkHttpImplTest.java From symbol-sdk-java with Apache License 2.0 | 4 votes |
@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()); }
Example 19
Source File: UnremovableBeansTestCase.java From quarkus with Apache License 2.0 | 4 votes |
@Test void unusedBeanWhoseProducerMarkedAsUnemoveableShouldBeAccessible() { Assertions.assertNotNull(Arc.container().instance(ProducerOfUnusedUnremovableBean.Bean.class).get()); }
Example 20
Source File: KafkaTestClusterTest.java From kafka-junit with BSD 3-Clause "New" or "Revised" License | 2 votes |
/** * 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()); }