optimizing: fix gtests by taking into account that the compilation unit is null during tests. Change-Id: I01a28ce8f03c927ff679b84bcdf2464fa97e0924