@Test
  public void testFipsOnlyModeEnabledAtRuntimeWithBoringCrypto() throws GeneralSecurityException {
    // Test behavior when FIPS-only mode is set at runtime.
    Assume.assumeFalse(TinkFipsUtil.useOnlyFips());
    // BoringCrypto is available, therefore an algorithm which has a FIPS validated
    // implementation is compatible.
    Assume.assumeTrue(TinkFipsUtil.fipsModuleAvailable());

    TinkFipsUtil.setFipsRestricted();

    assertThat(TinkFipsUtil.AlgorithmFipsCompatibility.ALGORITHM_NOT_FIPS.isCompatible()).isFalse();
    assertThat(
            TinkFipsUtil.AlgorithmFipsCompatibility.ALGORITHM_REQUIRES_BORINGCRYPTO.isCompatible())
        .isTrue();
  }
Tests for TinkFipsUtil. The tests here check the behavior of Tink when built with or without the
--use_only_fips flag. In order to get complete coverage a build should be tested with: 1) Build
without the --use_only_fips flag. 2) Build with the --use_only_fips flag, and BoringCrypto not
being available. 3) Build with the --use_only_fips flag, and BoringCrypto being available.
java_src/src/test/java/com/google/crypto/tink/config/internal/TinkFipsUtilTest.java