chromium/third_party/jni_zero/test/golden/testPlaceholdersOverlapping-TinySampleJni.java.golden

//
// This file was generated by //third_party/jni_zero/jni_zero.py
//
package org.jni_zero;

import org.jni_zero.CheckDiscard;
import org.jni_zero.GEN_JNI;
import org.jni_zero.JniStaticTestMocker;
import org.jni_zero.NativeLibraryLoadedStatus;

@CheckDiscard("crbug.com/993421")
class TinySampleJni implements TinySample.Natives {
  private static TinySample.Natives testInstance;

  public static final JniStaticTestMocker<TinySample.Natives> TEST_HOOKS =
      new JniStaticTestMocker<TinySample.Natives>() {
    @Override
    public void setInstanceForTesting(TinySample.Natives instance) {
      if (!GEN_JNI.TESTING_ENABLED) {
        throw new RuntimeException(
            "Tried to set a JNI mock when mocks aren't enabled!");
      }
      testInstance = instance;
    }
  };

  @Override
  public boolean bar(int a, Object b) {
    return (boolean) GEN_JNI.org_jni_1zero_TinySample_bar(a, b);
  }

  @Override
  public void foo(Object a, int b) {
    GEN_JNI.org_jni_1zero_TinySample_foo(a, b);
  }

  public static TinySample.Natives get() {
    if (GEN_JNI.TESTING_ENABLED) {
      if (testInstance != null) {
        return testInstance;
      }
      if (GEN_JNI.REQUIRE_MOCK) {
        throw new UnsupportedOperationException(
            "No mock found for the native implementation of TinySample.Natives. "
            + "The current configuration requires implementations be mocked.");
      }
    }
    NativeLibraryLoadedStatus.checkLoaded();
    return new TinySampleJni();
  }
}