### Question:
BigQueryConnectorModule implements Module { static String calculateBillingProjectId(Optional<String> configParentProjectId, Optional<Credentials> credentials) { if (configParentProjectId.isPresent()) { return configParentProjectId.get(); } if (credentials.isPresent() && credentials.get() instanceof ServiceAccountCredentials) { return ((ServiceAccountCredentials) credentials.get()).getProjectId(); } return BigQueryOptions.getDefaultProjectId(); } BigQueryConnectorModule(NodeManager nodeManager); @Provides @Singleton static HeaderProvider createHeaderProvider(NodeManager nodeManager); @Override void configure(Binder binder); @Provides @Singleton BigQueryCredentialsSupplier provideBigQueryCredentialsSupplier(BigQueryConfig config); @Provides @Singleton BigQueryClient provideBigQueryClient(BigQueryConfig config, HeaderProvider headerProvider, BigQueryCredentialsSupplier bigQueryCredentialsSupplier);  }### Answer:
@Test public void testConfigurationOnly() { String projectId = BigQueryConnectorModule.calculateBillingProjectId(Optional.of("pid"), Optional.empty()); assertThat(projectId).isEqualTo("pid"); }
@Test public void testCredentialsOnly() throws Exception { String projectId = BigQueryConnectorModule.calculateBillingProjectId(Optional.empty(), credentials()); assertThat(projectId).isEqualTo("presto-bq-credentials-test"); }
@Test public void testBothConfigurationAndCredentials() throws Exception { String projectId = BigQueryConnectorModule.calculateBillingProjectId(Optional.of("pid"), credentials()); assertThat(projectId).isEqualTo("pid"); }