### Question:
AdManagerSession implements AdsSession, OAuth2Compatible { public void setOAuth2Credential(Credential oAuth2Credential) { Preconditions.checkNotNull(oAuth2Credential, "oAuth2Credential cannot be null."); clearAuthentication(); this.oAuth2Credential = oAuth2Credential; } private  AdManagerSession(Builder builder); String getApplicationName(); @Override Credential getOAuth2Credential(); void setOAuth2Credential(Credential oAuth2Credential); @Override String getEndpoint(); String getNetworkCode(); void setNetworkCode(String networkCode); Builder newBuilder(); static final String DEFAULT_ENDPOINT; }### Answer:
@Test public void testSetAutentication_null() throws Exception { AdManagerSession adManagerSession = build( new AdManagerSession.Builder() .withApplicationName("FooBar") .withEndpoint("https: .withOAuth2Credential(credential) .withNetworkCode("networkCode")); if (isImmutable) { thrown.expect(UnsupportedOperationException.class); } else { thrown.expect(NullPointerException.class); } thrown.expectMessage("oAuth2Credential"); adManagerSession.setOAuth2Credential(null); }