All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.robolectric.shadows.ShadowNetwork Maven / Gradle / Ivy

The newest version!
package org.robolectric.shadows;

import android.net.Network;

import org.robolectric.annotation.Implements;
import org.robolectric.shadow.api.Shadow;

import static android.os.Build.VERSION_CODES.LOLLIPOP;

@Implements(value = Network.class, minSdk = LOLLIPOP)
public class ShadowNetwork {
  private int netId;

  /**
   * Creates new instance of {@link Network}, because its constructor is hidden.
   *
   * @param netId The netId.
   * @return The Network instance.
   */
  public static Network newInstance(int netId) {
    Network network = Shadow.newInstance(Network.class, new Class[]{int.class}, new Object[]{netId});
    return network;
  }

  public void __constructor__(int netId) {
    this.netId = netId;
  }

  /**
   * Allows to get the stored netId.
   *
   * @return The netId.
   */
  public int getNetId() {
    return netId;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy