### Question:
CassandraTokenSplitManager { public long getTotalPartitionsCount(String keyspace, String table, Optional<Long> sessionSplitsPerNode) { if (sessionSplitsPerNode.isPresent()) { return sessionSplitsPerNode.get(); } if (configSplitsPerNode.isPresent()) { return configSplitsPerNode.get(); } List<SizeEstimate> estimates = session.getSizeEstimates(keyspace, table); return estimates.stream() .mapToLong(SizeEstimate::getPartitionsCount) .sum(); } @Inject  CassandraTokenSplitManager(CassandraSession session, CassandraClientConfig config);  CassandraTokenSplitManager(CassandraSession session, int splitSize, Optional<Long> configSplitsPerNode); List<TokenSplit> getSplits(String keyspace, String table, Optional<Long> sessionSplitsPerNode); long getTotalPartitionsCount(String keyspace, String table, Optional<Long> sessionSplitsPerNode);  }### Answer:
@Test public void testPartitionCountOverride() throws Exception { String tableName = "partition_count_override_table"; session.execute(format("CREATE TABLE %s.%s (key text PRIMARY KEY)", KEYSPACE, tableName)); server.refreshSizeEstimates(KEYSPACE, tableName); CassandraTokenSplitManager onlyConfigSplitsPerNode = new CassandraTokenSplitManager(session, SPLIT_SIZE, Optional.of(12_345L)); assertEquals(onlyConfigSplitsPerNode.getTotalPartitionsCount(KEYSPACE, tableName, Optional.empty()), 12_345L); CassandraTokenSplitManager onlySessionSplitsPerNode = new CassandraTokenSplitManager(session, SPLIT_SIZE, Optional.empty()); assertEquals(onlySessionSplitsPerNode.getTotalPartitionsCount(KEYSPACE, tableName, Optional.of(67_890L)), 67_890L); CassandraTokenSplitManager sessionOverrideConfig = new CassandraTokenSplitManager(session, SPLIT_SIZE, Optional.of(12_345L)); assertEquals(sessionOverrideConfig.getTotalPartitionsCount(KEYSPACE, tableName, Optional.of(67_890L)), 67_890L); CassandraTokenSplitManager defaultSplitManager = new CassandraTokenSplitManager(session, SPLIT_SIZE, Optional.empty()); assertEquals(defaultSplitManager.getTotalPartitionsCount(KEYSPACE, tableName, Optional.empty()), 0); }