org.fest.assertions.api.android.hardware.usb.UsbInterfaceAssert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fest-android Show documentation
Show all versions of fest-android Show documentation
A set of FEST assertion helpers geared toward testing Android.
// Copyright 2013 Square, Inc.
package org.fest.assertions.api.android.hardware.usb;
import android.hardware.usb.UsbInterface;
import org.fest.assertions.api.Assertions;
import org.fest.assertions.api.AbstractAssert;
/** Assertions for {@link UsbInterface} instances. */
public class UsbInterfaceAssert extends AbstractAssert {
public UsbInterfaceAssert(UsbInterface actual) {
super(actual, UsbInterfaceAssert.class);
}
public UsbInterfaceAssert hasEndpointCount(int count) {
isNotNull();
int actualCount = actual.getEndpointCount();
Assertions.assertThat(actualCount) //
.overridingErrorMessage("Expected endpoint count <%s> but was <%s>.", count, actualCount) //
.isEqualTo(count);
return this;
}
public UsbInterfaceAssert hasId(int id) {
isNotNull();
int actualId = actual.getId();
Assertions.assertThat(actualId) //
.overridingErrorMessage("Expected id <%s> but was <%s>.", id, actualId) //
.isEqualTo(id);
return this;
}
public UsbInterfaceAssert hasInterfaceClass(int interfaceClass) {
isNotNull();
int actualInterfaceClass = actual.getInterfaceClass();
Assertions.assertThat(actualInterfaceClass) //
.overridingErrorMessage("Expected interface class <%s> but was <%s>.", interfaceClass,
actualInterfaceClass) //
.isEqualTo(interfaceClass);
return this;
}
public UsbInterfaceAssert hasInterfaceProtocol(int protocol) {
isNotNull();
int actualProtocol = actual.getInterfaceProtocol();
Assertions.assertThat(actualProtocol) //
.overridingErrorMessage("Expected interface protocol <%s> but was <%s>.", protocol,
actualProtocol) //
.isEqualTo(protocol);
return this;
}
public UsbInterfaceAssert hasInterfaceSubclass(int subclass) {
isNotNull();
int actualSubclass = actual.getInterfaceSubclass();
Assertions.assertThat(actualSubclass) //
.overridingErrorMessage("Expected interface subclass <%s> but was <%s>.", subclass,
actualSubclass) //
.isEqualTo(subclass);
return this;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy