SamplingFlags { public final boolean sampledLocal() { return (flags & FLAG_SAMPLED_LOCAL) == FLAG_SAMPLED_LOCAL; } SamplingFlags(int flags); @Nullable final Boolean sampled(); final boolean sampledLocal(); final boolean debug(); @Override String toString(); static final SamplingFlags EMPTY; static final SamplingFlags NOT_SAMPLED; static final SamplingFlags SAMPLED; static final SamplingFlags DEBUG; }
@Test public void sampledLocal() { SamplingFlags.Builder flagsBuilder = new SamplingFlags.Builder(); flagsBuilder.flags |= FLAG_SAMPLED_LOCAL; SamplingFlags flags = flagsBuilder.build(); assertThat(flags).isSameAs(SamplingFlags.EMPTY_SAMPLED_LOCAL); assertThat(flags.sampledLocal()).isTrue(); assertThat(flags.sampled()).isNull(); }