ProgramState implements ProgramStateConstraints { @Override public Constraint getConstraint(@Nullable SymbolicValue value) { Constraint storedConstraint = constraints.get(value); storedConstraint = storedConstraint == null ? Constraint.ANY_VALUE : storedConstraint; return value == null ? storedConstraint : storedConstraint.and(value.baseConstraint(this)); } private  ProgramState(
    ImmutableMap<Symbol, SymbolicValue> values,
    ImmutableMap<SymbolicValue, Constraint> constraints,
    ExpressionStack stack,
    ImmutableSet<Relation> relations,
    int counter); ImmutableMap<Symbol, SymbolicValue> values(); static ProgramState emptyState(); ProgramState newSymbolicValue(Symbol symbol, @Nullable Constraint constraint); ProgramState newFunctionSymbolicValue(Symbol symbol, FunctionTree functionTree); Optional<ProgramState> constrain(@Nullable SymbolicValue value, @Nullable Constraint constraint); @CheckForNull SymbolicValue getSymbolicValue(@Nullable Symbol symbol); @Override Constraint getConstraint(@Nullable SymbolicValue value); Constraint getConstraint(@Nullable Symbol symbol); ProgramState pushToStack(SymbolicValue value); ProgramState removeLastValue(); ProgramState clearStack(Tree element); void assertEmptyStack(Tree element); ProgramState execute(ExpressionTree expression); ProgramState withStack(ExpressionStack newStack); ProgramState assignment(Symbol variable); ProgramState assignment(Symbol variable, SymbolicValue value); Set<Relation> relations(); ProgramState addRelation(Relation relation); @Override boolean equals(Object o); @Override int hashCode(); SymbolicValue peekStack(); SymbolicValue peekStack(int n); ProgramState removeSymbols(Set<Symbol> symbolsToKeep); @Deprecated ExpressionStack getStack(); @Override String toString(); @Nullable SymbolicValue getSymbolicValue(IdentifierTree identifier, SymbolicExecution execution);  }
@Test public void getConstraint() { SymbolicValue sv1 = mock(SymbolicValue.class); state = state.pushToStack(sv1).assignment(symbol1).removeLastValue(); when(sv1.baseConstraint(state)).thenReturn(Constraint.ANY_VALUE); assertThat(state.getConstraint(sv1)).isEqualTo(Constraint.ANY_VALUE); when(sv1.baseConstraint(state)).thenReturn(Constraint.BOOLEAN_PRIMITIVE); assertThat(state.getConstraint(sv1)).isEqualTo(Constraint.BOOLEAN_PRIMITIVE); SymbolicValue sv2 = new SymbolicValueWithConstraint(Constraint.BOOLEAN_PRIMITIVE); state = state.pushToStack(sv2).assignment(symbol1).removeLastValue(); state = state.constrain(sv2, Constraint.TRUTHY).get(); assertThat(state.getConstraint(sv2)).isEqualTo(Constraint.TRUE); }