Java Code Examples for org.junit.Assert#assertNotNull()
The following examples show how to use
org.junit.Assert#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: ClusterStatsManagerTest.java From sofa-jraft with Apache License 2.0 | 6 votes |
@Test public void findLazyWorkerStoresTest() { final ClusterStatsManager manager = ClusterStatsManager.getInstance(1); manager.addOrUpdateLeader(10, 101); manager.addOrUpdateLeader(10, 102); manager.addOrUpdateLeader(10, 103); manager.addOrUpdateLeader(11, 104); manager.addOrUpdateLeader(11, 105); manager.addOrUpdateLeader(12, 106); final Collection<Long> storeCandidates = Lists.newArrayList(); storeCandidates.add(10L); storeCandidates.add(11L); storeCandidates.add(12L); List<Pair<Long, Integer>> result = manager.findLazyWorkerStores(storeCandidates); Assert.assertNotNull(result); Assert.assertEquals(1, result.size()); Assert.assertEquals(Long.valueOf(12), result.get(0).getKey()); Assert.assertEquals(Integer.valueOf(1), result.get(0).getValue()); manager.addOrUpdateLeader(10, 105); result = manager.findLazyWorkerStores(storeCandidates); Assert.assertNotNull(result); Assert.assertEquals(2, result.size()); Assert.assertEquals(Integer.valueOf(1), result.get(0).getValue()); }
Example 2
Source File: ThreadPoolConfigurationTest.java From camel-spring-boot with Apache License 2.0 | 6 votes |
@Test public void testThreadPool() throws Exception { ThreadPoolProfile dpp = context.getExecutorServiceManager().getDefaultThreadPoolProfile(); Assert.assertNotNull(dpp); Assert.assertEquals("default", dpp.getId()); Assert.assertEquals(5, dpp.getPoolSize().intValue()); Assert.assertEquals(10, dpp.getMaxPoolSize().intValue()); Assert.assertEquals(20, dpp.getMaxQueueSize().intValue()); Assert.assertEquals(ThreadPoolRejectedPolicy.DiscardOldest, dpp.getRejectedPolicy()); ThreadPoolProfile sp = context.getExecutorServiceManager().getThreadPoolProfile("smallPool"); Assert.assertNotNull(sp); Assert.assertEquals("smallPool", sp.getId()); Assert.assertEquals(2, sp.getPoolSize().intValue()); Assert.assertEquals(10, sp.getMaxPoolSize().intValue()); Assert.assertEquals(20, sp.getMaxQueueSize().intValue()); Assert.assertEquals(ThreadPoolRejectedPolicy.Abort, sp.getRejectedPolicy()); ThreadPoolProfile bp = context.getExecutorServiceManager().getThreadPoolProfile("bigPool"); Assert.assertNotNull(bp); Assert.assertEquals("bigPool", bp.getId()); Assert.assertEquals(20, bp.getPoolSize().intValue()); Assert.assertEquals(50, bp.getMaxPoolSize().intValue()); Assert.assertEquals(500, bp.getMaxQueueSize().intValue()); Assert.assertEquals(ThreadPoolRejectedPolicy.DiscardOldest, bp.getRejectedPolicy()); }
Example 3
Source File: LdapBackendTestClientCert.java From deprecated-security-advanced-modules with Apache License 2.0 | 6 votes |
@Test public void testLdapSslAuthNo() throws Exception { final Settings settings = Settings.builder() .putList(ConfigConstants.LDAP_HOSTS, "localhost:636") .put(ConfigConstants.LDAP_AUTHC_USERSEARCH, "(uid={0})") .put(ConfigConstants.LDAPS_ENABLE_SSL, true) .put("opendistro_security.ssl.transport.keystore_filepath", "/Users/temp/opendistro_security_integration_tests/ldap/ssl-root-ca/kirk-keystore.jks") .put("opendistro_security.ssl.transport.truststore_filepath", "/Users/temp/opendistro_security_integration_tests/ldap/ssl-root-ca/truststore.jks") .put(ConfigConstants.LDAPS_ENABLE_SSL_CLIENT_AUTH, true) .put(ConfigConstants.LDAPS_JKS_CERT_ALIAS, "kirk") .put(ConfigConstants.LDAP_AUTHC_USERBASE, "ou=people,dc=example,dc=com") .put(ConfigConstants.LDAP_AUTHC_USERNAME_ATTRIBUTE, "uid") .put("path.home",".") .build(); final LdapUser user = (LdapUser) new LDAPAuthenticationBackend(settings, null).authenticate(new AuthCredentials("ldap_hr_employee" , "ldap_hr_employee" .getBytes(StandardCharsets.UTF_8))); Assert.assertNotNull(user); Assert.assertEquals("ldap_hr_employee", user.getName()); }
Example 4
Source File: TermExpressionParserTest.java From hsweb-framework with Apache License 2.0 | 6 votes |
@Test public void testNest() { String expression = "name = 测试 and (age > 10 or age <= 20) and test like test2 and (age gt age2 or age btw age3,age4 or (age > 10 or age <= 20))"; System.out.println(expression); List<Term> terms = TermExpressionParser.parse(expression); System.out.println(JSON.toJSONString(terms, SerializerFeature.PrettyFormat)); Assert.assertNotNull(terms); Assert.assertEquals(terms.size(), 4); Assert.assertEquals(terms.get(1).getTerms().size(),2); Assert.assertEquals(terms.get(0).getColumn(), "name"); Assert.assertEquals(terms.get(0).getValue(), "测试"); Assert.assertEquals(terms.get(1).getTerms().get(0).getColumn(), "age"); Assert.assertEquals(terms.get(1).getTerms().get(0).getTermType(), "gt"); Assert.assertEquals(terms.get(1).getTerms().get(0).getValue(), "10"); Assert.assertEquals(terms.get(1).getTerms().get(1).getColumn(), "age"); Assert.assertEquals(terms.get(1).getTerms().get(1).getTermType(), "lte"); Assert.assertEquals(terms.get(1).getTerms().get(1).getValue(), "20"); Assert.assertEquals(terms.get(1).getTerms().get(1).getType(), Term.Type.or); Assert.assertEquals(terms.get(2).getColumn(), "test"); Assert.assertEquals(terms.get(2).getValue(), "test2"); Assert.assertEquals(terms.get(2).getTermType(), "like"); }
Example 5
Source File: DozerTest.java From tools-journey with Apache License 2.0 | 6 votes |
@Test public void testInnerBean() { model.setInner(new UserModelInner("user-model-inner-a", "user-model-inner-b")); System.out.println("UserModel:" + model); UserData data = mapper.map(model, UserData.class); Assert.assertNotNull(data); System.out.println("UserData:" + data); Assert.assertNotNull(data.getUserId()); Assert.assertNotNull(data.getNickname()); Assert.assertNull(data.getPasswd()); Assert.assertNotNull(data.getInner()); Assert.assertEquals(model.getInner().getInnerA(), data.getInner().getInnerA()); Assert.assertEquals(model.getInner().getInnerB(), data.getInner().getInnerB()); }
Example 6
Source File: SpringBootDataFlywayApplicationTests.java From spring-boot-tutorial with Creative Commons Attribution Share Alike 4.0 International | 6 votes |
@Test public void batchInsert() { List<User> users = new ArrayList<>(); users.add(new User("张三", 21, "南京", "[email protected]")); users.add(new User("李四", 28, "上海", "[email protected]")); users.add(new User("王五", 24, "北京", "[email protected]")); users.add(new User("赵六", 31, "广州", "[email protected]")); userDAO.batchInsert(users); int count = userDAO.count(); Assert.assertEquals(4, count); List<User> list = userDAO.list(); Assert.assertNotNull(list); Assert.assertEquals(4, list.size()); list.forEach(user -> { log.info(user.toString()); }); }
Example 7
Source File: TestOMVolumeDeleteRequest.java From hadoop-ozone with Apache License 2.0 | 5 votes |
@Test public void testValidateAndUpdateCacheSuccess() throws Exception { String volumeName = UUID.randomUUID().toString(); String ownerName = "user1"; OMRequest originalRequest = deleteVolumeRequest(volumeName); OMVolumeDeleteRequest omVolumeDeleteRequest = new OMVolumeDeleteRequest(originalRequest); omVolumeDeleteRequest.preExecute(ozoneManager); // Add volume and user to DB TestOMRequestUtils.addVolumeToDB(volumeName, ownerName, omMetadataManager); TestOMRequestUtils.addUserToDB(volumeName, ownerName, omMetadataManager); String volumeKey = omMetadataManager.getVolumeKey(volumeName); String ownerKey = omMetadataManager.getUserKey(ownerName); Assert.assertNotNull(omMetadataManager.getVolumeTable().get(volumeKey)); Assert.assertNotNull(omMetadataManager.getUserTable().get(ownerKey)); OMClientResponse omClientResponse = omVolumeDeleteRequest.validateAndUpdateCache(ozoneManager, 1, ozoneManagerDoubleBufferHelper); OzoneManagerProtocolProtos.OMResponse omResponse = omClientResponse.getOMResponse(); Assert.assertNotNull(omResponse.getCreateVolumeResponse()); Assert.assertEquals(OzoneManagerProtocolProtos.Status.OK, omResponse.getStatus()); Assert.assertTrue(omMetadataManager.getUserTable().get(ownerKey) .getVolumeNamesList().size() == 0); // As now volume is deleted, table should not have those entries. Assert.assertNull(omMetadataManager.getVolumeTable().get(volumeKey)); }
Example 8
Source File: ClaimsRequestResolverTest.java From graviteeio-access-management with Apache License 2.0 | 5 votes |
@Test public void shouldResolveClaimsRequest() throws ClaimsRequestSyntaxException { String claims = "{ \"userinfo\": {\"name\": {\"essential\": true}, \"family_name\": null}, " + "\"id_token\": {\"name\": {\"essential\": true}, \"family_name\": null}}"; ClaimsRequest claimsRequest = claimsRequestResolver.resolve(claims); Assert.assertNotNull(claimsRequest.getUserInfoClaims()); Assert.assertNotNull(claimsRequest.getIdTokenClaims()); Assert.assertTrue(claimsRequest.getUserInfoClaims().size() == 2); Assert.assertTrue(claimsRequest.getUserInfoClaims().containsKey("name")); Assert.assertTrue(claimsRequest.getUserInfoClaims().containsKey("family_name")); Assert.assertTrue(claimsRequest.getIdTokenClaims().size() == 2); Assert.assertTrue(claimsRequest.getIdTokenClaims().containsKey("name")); Assert.assertTrue(claimsRequest.getIdTokenClaims().containsKey("family_name")); }
Example 9
Source File: TestKerberosProperties.java From localization_nifi with Apache License 2.0 | 5 votes |
@Test public void testWithKerberosConfigFile() { final File file = new File("src/test/resources/krb5.conf"); final KerberosProperties kerberosProperties = new KerberosProperties(file); Assert.assertNotNull(kerberosProperties); Assert.assertNotNull(kerberosProperties.getKerberosConfigFile()); Assert.assertNotNull(kerberosProperties.getKerberosConfigValidator()); Assert.assertNotNull(kerberosProperties.getKerberosPrincipal()); Assert.assertNotNull(kerberosProperties.getKerberosKeytab()); final ValidationResult result = kerberosProperties.getKerberosConfigValidator().validate("test", "principal", null); Assert.assertTrue(result.isValid()); }
Example 10
Source File: SWARM_513Test.java From thorntail with Apache License 2.0 | 5 votes |
private void checkAvailability() throws Exception { Client client = ClientBuilder.newClient(); WebTarget target = client.target("http://localhost:8080").path("tickets"); Response response = target.request(MediaType.TEXT_XML).get(); Assert.assertEquals(200, response.getStatus()); Tickets dto = response.readEntity(Tickets.class); Assert.assertNotNull("Response is not a list", dto.getTickets()); Assert.assertEquals("Expected a single entity in response collection", dto.getTickets().size(), 1); Assert.assertEquals("Ticket ID didn't match expected output", dto.getTickets().get(0).getId(), new Long(1)); }
Example 11
Source File: RaftStateMachineExceptionTests.java From incubator-ratis with Apache License 2.0 | 5 votes |
private void runTestRetryOnExceptionDuringReplication(CLUSTER cluster) throws Exception { final RaftServerImpl oldLeader = RaftTestUtil.waitForLeader(cluster); cluster.getLeaderAndSendFirstMessage(true); // turn on the preAppend failure switch failPreAppend = true; try (final RaftClient client = cluster.createClient(oldLeader.getId())) { final RaftClientRpc rpc = client.getClientRpc(); final long callId = 999; final SimpleMessage message = new SimpleMessage("message"); RaftClientRequest r = cluster.newRaftClientRequest(client.getId(), oldLeader.getId(), callId, message); RaftClientReply reply = rpc.sendRequest(r); Objects.requireNonNull(reply.getStateMachineException()); final RetryCache.CacheEntry oldEntry = RaftServerTestUtil.getRetryEntry(oldLeader, client.getId(), callId); Assert.assertNotNull(oldEntry); Assert.assertTrue(RaftServerTestUtil.isRetryCacheEntryFailed(oldEntry)); // At this point of time the old leader would have stepped down. wait for leader election to complete final RaftServerImpl leader = RaftTestUtil.waitForLeader(cluster); // retry r = cluster.newRaftClientRequest(client.getId(), leader.getId(), callId, message); reply = rpc.sendRequest(r); Objects.requireNonNull(reply.getStateMachineException()); RetryCache.CacheEntry currentEntry = RaftServerTestUtil.getRetryEntry( leader, client.getId(), callId); Assert.assertNotNull(currentEntry); Assert.assertTrue(RaftServerTestUtil.isRetryCacheEntryFailed(currentEntry)); Assert.assertNotEquals(oldEntry, currentEntry); failPreAppend = false; } }
Example 12
Source File: ExternalChildResourceTests.java From azure-libraries-for-java with MIT License | 5 votes |
@Test public void canCreateChildrenIndependently() throws Exception { SchoolsImpl schools = new SchoolsImpl(); Creatable<SchoolsImpl.TeacherImpl> creatableTeacher = schools.independentTeachers() .define("john") .withSubject("physics"); Creatable<SchoolsImpl.StudentImpl> creatableStudent = schools.independentStudents() .define("nit") .withAge(15) .withTeacher(creatableTeacher); final SchoolsImpl.TeacherImpl foundTeacher[] = new SchoolsImpl.TeacherImpl[1]; final SchoolsImpl.StudentImpl foundStudent[] = new SchoolsImpl.StudentImpl[1]; creatableStudent.createAsync() .doOnNext(new Action1<Indexable>() { @Override public void call(Indexable indexable) { if (indexable instanceof SchoolsImpl.TeacherImpl) { foundTeacher[0] = (SchoolsImpl.TeacherImpl) indexable; } if (indexable instanceof SchoolsImpl.StudentImpl) { foundStudent[0] = (SchoolsImpl.StudentImpl) indexable; } } }).toBlocking().last(); Assert.assertNotNull(foundTeacher[0]); Assert.assertNotNull(foundStudent[0]); Assert.assertTrue(foundTeacher[0].isInvoked()); Assert.assertTrue(foundStudent[0].isInvoked()); }
Example 13
Source File: AccountResourceTest.java From eplmp with Eclipse Public License 1.0 | 5 votes |
@Test public void deleteGCMAccountTest() throws EntityNotFoundException { Response response = accountResource.deleteGCMAccount(); Assert.assertEquals(Response.Status.NO_CONTENT.getStatusCode(), response.getStatus()); Mockito.doThrow(new GCMAccountNotFoundException("foo")).when(accountManager).deleteGCMAccount(); try { accountResource.deleteGCMAccount(); Assert.fail("Should have thrown"); } catch (EntityNotFoundException e) { Assert.assertNotNull(e.getMessage()); } }
Example 14
Source File: CurrentMasterChooseCommandTest.java From x-pipe with Apache License 2.0 | 5 votes |
@Test public void testSlaveTimeout() throws Exception { redis1Master = true; redis2Master = false; redis2.stop(); redis2 = null; RedisMeta redisMeta = chooseCommand.choose(); Assert.assertNotNull(redisMeta); Assert.assertEquals(redis1.getPort(), redisMeta.getPort().intValue()); Assert.assertEquals(gid, redisMeta.getGid().intValue()); }
Example 15
Source File: PojoUtilsTest.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
@Test public void testMapField() throws Exception { TestData data = new TestData(); Child child = newChild("first", 1); data.addChild(child); child = newChild("second", 2); data.addChild(child); child = newChild("third", 3); data.addChild(child); data.setList(Arrays.asList(newChild("forth", 4))); Object obj = PojoUtils.generalize(data); Assert.assertEquals(3, data.getChildren().size()); Assert.assertTrue(data.getChildren().get("first").getClass() == Child.class); Assert.assertEquals(1, data.getList().size()); Assert.assertTrue(data.getList().get(0).getClass() == Child.class); TestData realizadData = (TestData) PojoUtils.realize(obj, TestData.class); Assert.assertEquals(data.getChildren().size(), realizadData.getChildren().size()); Assert.assertEquals(data.getChildren().keySet(), realizadData.getChildren().keySet()); for(Map.Entry<String, Child> entry : data.getChildren().entrySet()) { Child c = realizadData.getChildren().get(entry.getKey()); Assert.assertNotNull(c); Assert.assertEquals(entry.getValue().getName(), c.getName()); Assert.assertEquals(entry.getValue().getAge(), c.getAge()); } Assert.assertEquals(1, realizadData.getList().size()); Assert.assertEquals(data.getList().get(0).getName(), realizadData.getList().get(0).getName()); Assert.assertEquals(data.getList().get(0).getAge(), realizadData.getList().get(0).getAge()); }
Example 16
Source File: TestReadProjection.java From iceberg with Apache License 2.0 | 4 votes |
@Test @SuppressWarnings("unchecked") public void testListOfStructsProjection() throws IOException { Schema writeSchema = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()), Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.required(19, "x", Types.IntegerType.get()), Types.NestedField.optional(18, "y", Types.IntegerType.get()) )) ) ); Record record = GenericRecord.create(writeSchema.asStruct()); record.setField("id", 34L); Record p1 = GenericRecord.create(writeSchema.findType("points").asListType().elementType().asStructType()); p1.setField("x", 1); p1.setField("y", 2); Record p2 = GenericRecord.create(writeSchema.findType("points").asListType().elementType().asStructType()); p2.setField("x", 3); p2.setField("y", null); record.setField("points", ImmutableList.of(p1, p2)); Schema idOnly = new Schema( Types.NestedField.required(0, "id", Types.LongType.get()) ); Record projected = writeAndRead("id_only", writeSchema, idOnly, record); Assert.assertEquals("Should contain the correct id value", 34L, (long) projected.getField("id")); Assert.assertNull("Should not project points list", projected.getField("points")); projected = writeAndRead("all_points", writeSchema, writeSchema.select("points"), record); Assert.assertNull("Should not project id", projected.getField("id")); Assert.assertEquals("Should project points list", record.getField("points"), projected.getField("points")); projected = writeAndRead("x_only", writeSchema, writeSchema.select("points.x"), record); Assert.assertNull("Should not project id", projected.getField("id")); Assert.assertNotNull("Should project points list", projected.getField("points")); List<Record> points = (List<Record>) projected.getField("points"); Assert.assertEquals("Should read 2 points", 2, points.size()); Record projectedP1 = points.get(0); Assert.assertEquals("Should project x", 1, (int) projectedP1.getField("x")); Assert.assertNull("Should not project y", projectedP1.getField("y")); Record projectedP2 = points.get(1); Assert.assertEquals("Should project x", 3, (int) projectedP2.getField("x")); Assert.assertNull("Should not project y", projectedP2.getField("y")); projected = writeAndRead("y_only", writeSchema, writeSchema.select("points.y"), record); Assert.assertNull("Should not project id", projected.getField("id")); Assert.assertNotNull("Should project points list", projected.getField("points")); points = (List<Record>) projected.getField("points"); Assert.assertEquals("Should read 2 points", 2, points.size()); projectedP1 = points.get(0); Assert.assertNull("Should not project x", projectedP1.getField("x")); Assert.assertEquals("Should project y", 2, (int) projectedP1.getField("y")); projectedP2 = points.get(1); Assert.assertNull("Should not project x", projectedP2.getField("x")); Assert.assertEquals("Should project null y", null, projectedP2.getField("y")); Schema yRenamed = new Schema( Types.NestedField.optional(22, "points", Types.ListType.ofOptional(21, Types.StructType.of( Types.NestedField.optional(18, "z", Types.IntegerType.get()) )) ) ); projected = writeAndRead("y_renamed", writeSchema, yRenamed, record); Assert.assertNull("Should not project id", projected.getField("id")); Assert.assertNotNull("Should project points list", projected.getField("points")); points = (List<Record>) projected.getField("points"); Assert.assertEquals("Should read 2 points", 2, points.size()); projectedP1 = points.get(0); Assert.assertNull("Should not project x", projectedP1.getField("x")); Assert.assertNull("Should not project y", projectedP1.getField("y")); Assert.assertEquals("Should project z", 2, (int) projectedP1.getField("z")); projectedP2 = points.get(1); Assert.assertNull("Should not project x", projectedP2.getField("x")); Assert.assertNull("Should not project y", projectedP2.getField("y")); Assert.assertEquals("Should project null z", null, projectedP2.getField("z")); }
Example 17
Source File: TestApplicationHistoryManagerOnTimelineStore.java From hadoop with Apache License 2.0 | 4 votes |
@Test public void testGetApplicationAttemptReport() throws Exception { final ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1); ApplicationAttemptReport appAttempt; if (callerUGI == null) { appAttempt = historyManager.getApplicationAttempt(appAttemptId); } else { try { appAttempt = callerUGI.doAs(new PrivilegedExceptionAction<ApplicationAttemptReport> () { @Override public ApplicationAttemptReport run() throws Exception { return historyManager.getApplicationAttempt(appAttemptId); } }); if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) { // The exception is expected Assert.fail(); } } catch (AuthorizationException e) { if (callerUGI != null && callerUGI.getShortUserName().equals("user3")) { // The exception is expected return; } throw e; } } Assert.assertNotNull(appAttempt); Assert.assertEquals(appAttemptId, appAttempt.getApplicationAttemptId()); Assert.assertEquals(ContainerId.newContainerId(appAttemptId, 1), appAttempt.getAMContainerId()); Assert.assertEquals("test host", appAttempt.getHost()); Assert.assertEquals(100, appAttempt.getRpcPort()); Assert.assertEquals("test tracking url", appAttempt.getTrackingUrl()); Assert.assertEquals("test original tracking url", appAttempt.getOriginalTrackingUrl()); Assert.assertEquals("test diagnostics info", appAttempt.getDiagnostics()); Assert.assertEquals(YarnApplicationAttemptState.FINISHED, appAttempt.getYarnApplicationAttemptState()); }
Example 18
Source File: InternalAgentTest.java From ans-android-sdk with GNU General Public License v3.0 | 4 votes |
@Test public void isCalibrated() { Assert.assertNotNull(InternalAgent.isCalibrated(mContext)); }
Example 19
Source File: BundleCollectorTest.java From ict with Apache License 2.0 | 4 votes |
private static void assertBundleComplete(Ict ict, String hashOfBundleHead) { Transaction head = ict.findTransactionByHash(hashOfBundleHead); Assert.assertNotNull("Ict did not receive head of bundle", head); Bundle bundle = new Bundle(head); Assert.assertTrue("Ict did not receive complete bundle", bundle.isComplete()); }
Example 20
Source File: EventHubTests.java From azure-libraries-for-java with MIT License | 4 votes |
@Test @Ignore("Test uses data plane storage api") public void canEnableEventHubDataCaptureOnUpdate() { RG_NAME = generateRandomResourceName("javacsmrg", 15); final String stgName = SdkContext.randomResourceName("stg", 14); final String namespaceName = SdkContext.randomResourceName("ns", 14); final String eventHubName = SdkContext.randomResourceName("eh", 14); Creatable<EventHubNamespace> namespaceCreatable = eventHubManager.namespaces() .define(namespaceName) .withRegion(REGION) .withNewResourceGroup(RG_NAME); EventHub eventHub = eventHubManager.eventHubs() .define(eventHubName) .withNewNamespace(namespaceCreatable) .create(); boolean exceptionThrown = false; try { eventHub.update() .withDataCaptureEnabled() .apply(); } catch (IllegalStateException ex) { exceptionThrown = true; } Assert.assertTrue("Expected IllegalStateException is not thrown", exceptionThrown); eventHub = eventHub.refresh(); Creatable<StorageAccount> storageAccountCreatable = storageManager.storageAccounts() .define(stgName) .withRegion(REGION) .withNewResourceGroup(RG_NAME) .withSku(StorageAccountSkuType.STANDARD_LRS); eventHub.update() .withDataCaptureEnabled() .withNewStorageAccountForCapturedData(storageAccountCreatable, "eventctr") .apply(); Assert.assertTrue(eventHub.isDataCaptureEnabled()); Assert.assertNotNull(eventHub.captureDestination()); Assert.assertTrue(eventHub.captureDestination().storageAccountResourceId().contains("/storageAccounts/")); Assert.assertTrue(eventHub.captureDestination().storageAccountResourceId().contains(stgName)); Assert.assertTrue(eventHub.captureDestination().blobContainer().equalsIgnoreCase("eventctr")); }