Skip to content

No way to create an instance of Characteristic.Properties, prevents faking DiscoveredCharacteristic for tests #1111

@curioustechizen

Description

@curioustechizen

Consider this definition

public interface DiscoveredCharacteristic : Characteristic {
    public val descriptors: List<DiscoveredDescriptor>
    public val properties: Properties
}
  • Properties is a public value class with an internal constructor
  • All values of properties are marked internal(Broadcast, WriteWithoutResponse etc).

The result of this is that there is no way for me to create a fake for testing.

object FakeDiscoveredCharacteristic: DiscoveredCharacteristic {
    override val properties: Characteristic.Properties
        get() = Properties(4) // Cannot use this or WriteWithoutResponse
}

Would you consider offering some way to create an instance of Properties to unlock fakes? Or alternatively, do you have any suggestions for how to write unit tests for code that uses DiscoveredCharacteristic?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions