この便利なライブラリPODAMを見つけましたが、自動バイト配列を取得するのに苦労しています。実装された AttributeStrategy を使用しました
public class LogoStrategy implements AttributeStrategy<byte[]>{
private static final int MAX_SIZE_FILE = 512*1024;
@Override
public byte[] getValue() throws PodamMockeryException {
byte[] b = new byte[20];
new Random().nextBytes(b);
return b;
}
}
しかし、私が使用すると、このエラーが発生しました:
2014-10-21 20:13:04 PodamFactoryImpl [ERROR] The type of the Podam Attribute
Strategy is not java.lang.String but [B. An exception will be thrown.
Exception in thread "main" uk.co.jemos.podam.exceptions.PodamMockeryException: An illegal argument was passed
at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1569)
at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:129)
at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojo(PodamFactoryImpl.java:119)
at cl.molavec.jpa.entities.singleton.QuotationPropertiesSingleton.getNewInstance(QuotationPropertiesSingleton.java:26)
at cl.molavec.main.InsertDummyData.main(InsertDummyData.java:66)
Caused by: java.lang.IllegalArgumentException: The type of the Podam Attribute Strategy is not java.lang.String but [B. An exception will be thrown.
at uk.co.jemos.podam.api.PodamFactoryImpl.returnAttributeDataStrategyValue(PodamFactoryImpl.java:2888)
at uk.co.jemos.podam.api.PodamFactoryImpl.manufacturePojoInternal(PodamFactoryImpl.java:1493)
... 4 more
私は AttributeStrategy を実装しましたが、char[] 属性とすべての素晴らしいものを使用しました。理由が理解できなかったエラーは、文字列が必要です。
助言がありますか?
前もって感謝します。