chromium/third_party/jni_zero/test/golden/testUniqueAnnotations-SampleUniqueAnnotationsJni.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;
import org.jni_zero.SampleUniqueAnnotations;

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

  public static final JniStaticTestMocker<SampleUniqueAnnotations.Natives> TEST_HOOKS =
      new JniStaticTestMocker<SampleUniqueAnnotations.Natives>() {
    @Override
    public void setInstanceForTesting(SampleUniqueAnnotations.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 int bar(int x, int y) {
    return (int) GEN_JNI.org_jni_1zero_SampleUniqueAnnotations_bar(x, y);
  }

  @Override
  public void baz(SampleUniqueAnnotations.Handle handle) {
    assert handle != null;
    GEN_JNI.org_jni_1zero_SampleUniqueAnnotations_baz(handle);
  }

  @Override
  public void foo(long nativePtr, String arg) {
    assert nativePtr != 0;
    GEN_JNI.org_jni_1zero_SampleUniqueAnnotations_foo(nativePtr, arg);
  }

  public static SampleUniqueAnnotations.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 SampleUniqueAnnotations.Natives. "
            + "The current configuration requires implementations be mocked.");
      }
    }
    NativeLibraryLoadedStatus.checkLoaded();
    return new SampleUniqueAnnotationsJni();
  }
}