Thanks @blake.meike. I went through the LogTest
class more thoroughly and found that ultimately the majority of the tests are reliant on the internal com.couchbase.lite.internal.support.Log
class.
Of the non-test internal dependencies:
import com.couchbase.lite.internal.core.C4Constants
import com.couchbase.lite.internal.core.C4Log
import com.couchbase.lite.internal.core.CBLVersion
import com.couchbase.lite.internal.core.impl.NativeC4Log
import com.couchbase.lite.internal.support.Log
this support.Log
class is the biggest one that I’d need to find an equivalent way to call with the ObjC SDK in order to adapt the tests for common code, as it’s making these log calls in most of the tests. Seems like this code might be used similarly on iOS, but it’s not in the public API. It is accessible through these ObjC and Swift APIs, marked for use in unit tests. So it might be safe to use for the same purpose.
Additionally, this one test is using core.C4Log
, which requires core.impl.NativeC4Log
, which is not even accessible publicly in the Java jar.
Other than that, CBLVersion
is used in one test, which is also not clear if there’s a way to access this internal API in ObjC.
I was able to replace C4Constants
with the public LogLevel
enum ordinals, but this didn’t really help, as it’s only used in the one core.C4Log
and core.impl.NativeC4Log
test.
Tests that exclusively exercise the public API are:
testLogFileConfigurationConstructors()
testEditReadOnlyLogFileConfiguration()
testSetNewLogFileConfiguration()
testNonASCII()
I guess this makes sense, since the public API is mainly configuration, other than custom loggers. The actual logging is all happening internally.
testNonASCII()
is the one non-configuration test that doesn’t call the internal logger directly, instead relying on a query being logged. Unless other tests can be adapted similarly, it may make sense to move them to the internal package.