### Question:
DatastoreFactory { public HttpRequestFactory makeClient(DatastoreOptions options) { Credential credential = options.getCredential(); HttpTransport transport = options.getTransport(); if (transport == null) { transport = credential == null ? new NetHttpTransport() : credential.getTransport(); transport = transport == null ? new NetHttpTransport() : transport; } return transport.createRequestFactory(credential); }  static DatastoreFactory get(); Datastore create(DatastoreOptions options); HttpRequestFactory makeClient(DatastoreOptions options); static void logMethodCalls(); static final String VERSION; static final String DEFAULT_HOST; }### Answer:
@Test public void makeClient_Default() { DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .build(); HttpRequestFactory f = factory.makeClient(options); assertNotNull(f.getTransport()); assertTrue(f.getTransport() instanceof NetHttpTransport); }
@Test public void makeClient_WithCredential() { NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(transport) .build(); DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .credential(credential) .build(); HttpRequestFactory f = factory.makeClient(options); assertEquals(transport, f.getTransport()); }
@Test public void makeClient_WithTransport() { NetHttpTransport transport = new NetHttpTransport(); DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .transport(transport) .build(); HttpRequestFactory f = factory.makeClient(options); assertEquals(transport, f.getTransport()); }
@Test public void makeClient_WithCredentialTransport() { NetHttpTransport credTransport = new NetHttpTransport(); NetHttpTransport transport = new NetHttpTransport(); GoogleCredential credential = new GoogleCredential.Builder() .setTransport(credTransport) .build(); DatastoreOptions options = new DatastoreOptions.Builder() .projectId(PROJECT_ID) .credential(credential) .transport(transport) .build(); HttpRequestFactory f = factory.makeClient(options); assertNotSame(credTransport, f.getTransport()); assertEquals(transport, f.getTransport()); }