### Question:
CctTransportBackend implements TransportBackend { @Override public EventInternal decorate(EventInternal eventInternal) { NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo(); return eventInternal .toBuilder() .addMetadata(KEY_SDK_VERSION, Build.VERSION.SDK_INT) .addMetadata(KEY_MODEL, Build.MODEL) .addMetadata(KEY_HARDWARE, Build.HARDWARE) .addMetadata(KEY_DEVICE, Build.DEVICE) .addMetadata(KEY_PRODUCT, Build.PRODUCT) .addMetadata(KEY_OS_BUILD, Build.ID) .addMetadata(KEY_MANUFACTURER, Build.MANUFACTURER) .addMetadata(KEY_FINGERPRINT, Build.FINGERPRINT) .addMetadata(KEY_TIMEZONE_OFFSET, getTzOffset()) .addMetadata(KEY_NETWORK_TYPE, getNetTypeValue(networkInfo)) .addMetadata(KEY_MOBILE_SUBTYPE, getNetSubtypeValue(networkInfo)) .build(); } CctTransportBackend(
      Context applicationContext, Clock wallTimeClock, Clock uptimeClock, int readTimeout);   CctTransportBackend(Context applicationContext, Clock wallTimeClock, Clock uptimeClock); @Override EventInternal decorate(EventInternal eventInternal); @Override BackendResponse send(BackendRequest request);  }### Answer:
@Test public void decorate_whenOnline_shouldProperlyPopulateNetworkInfo() { CctTransportBackend backend = new CctTransportBackend(RuntimeEnvironment.application, wallClock, uptimeClock, 300); EventInternal result = backend.decorate( EventInternal.builder() .setEventMillis(INITIAL_WALL_TIME) .setUptimeMillis(INITIAL_UPTIME) .setTransportName("3") .setEncodedPayload(new EncodedPayload(PROTOBUF_ENCODING, PAYLOAD.toByteArray())) .build()); assertThat(result.get(CctTransportBackend.KEY_NETWORK_TYPE)) .isEqualTo(String.valueOf(NetworkConnectionInfo.NetworkType.MOBILE.getValue())); assertThat(result.get(CctTransportBackend.KEY_MOBILE_SUBTYPE)) .isEqualTo(String.valueOf(NetworkConnectionInfo.MobileSubtype.EDGE.getValue())); }
@Test @Config(shadows = {OfflineConnectivityManagerShadow.class}) public void decorate_whenOffline_shouldProperlyPopulateNetworkInfo() { CctTransportBackend backend = new CctTransportBackend(RuntimeEnvironment.application, wallClock, uptimeClock, 300); EventInternal result = backend.decorate( EventInternal.builder() .setEventMillis(INITIAL_WALL_TIME) .setUptimeMillis(INITIAL_UPTIME) .setTransportName("3") .setEncodedPayload(new EncodedPayload(PROTOBUF_ENCODING, PAYLOAD.toByteArray())) .build()); assertThat(result.get(CctTransportBackend.KEY_NETWORK_TYPE)) .isEqualTo(String.valueOf(NetworkConnectionInfo.NetworkType.NONE.getValue())); assertThat(result.get(CctTransportBackend.KEY_MOBILE_SUBTYPE)) .isEqualTo( String.valueOf(NetworkConnectionInfo.MobileSubtype.UNKNOWN_MOBILE_SUBTYPE.getValue())); }