Lambda在Java中返回字节数组

Lambda在Java中返回字节数组,java,lambda,Java,Lambda,我是java新手,我面临返回字节数组的lambda @Test @Parameters public void shouldThrowsExceptionWhenInvalidInput(Supplier<? extends AlphabeticDatatype> supplier) { catchException(supplier).get(); assertThat(caughtException()) .isExactlyInstan

我是java新手,我面临返回字节数组的lambda

@Test
@Parameters
public void shouldThrowsExceptionWhenInvalidInput(Supplier<? extends AlphabeticDatatype> supplier) {
    catchException(supplier).get();

    assertThat(caughtException())
            .isExactlyInstanceOf(IllegalArgumentException.class)
            .hasMessageStartingWith("i18n|ex.domain.datatype.alphabetic.length");
}

private Object[] parametersForShouldThrowsExceptionWhenInvalidInput() {
    return $(
            $((Supplier<AlphabeticDatatype>) () -> new StringDatatype("ASCII", true, 63).toBytes("")),
            $((Supplier<AlphabeticDatatype>) () -> new StringDatatype("UTF-8", true, 24))
    );
}
@测试
@参数
无效输入时,公共无效应通过例外(供应商原因很简单:

() -> new StringDatatype("ASCII", true, 63).toBytes("")
这是
供应商
类型,当您将其键入
(供应商)


打字是错误的。如果你这样做,那么你就是在假装。而且可能会出严重错误。

哦,当然。谢谢你,杰丁。
() -> new StringDatatype("ASCII", true, 63).toBytes("")