本文整理了Java中org.assertj.core.api.AbstractByteArrayAssert.isNotNull()
方法的一些代码示例,展示了AbstractByteArrayAssert.isNotNull()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AbstractByteArrayAssert.isNotNull()
方法的具体详情如下:
包路径:org.assertj.core.api.AbstractByteArrayAssert
类名称:AbstractByteArrayAssert
方法名:isNotNull
暂无
代码示例来源:origin: spring-projects/spring-security
@Test
public void standard() throws Exception {
CryptoAssumptions.assumeCBCJCE();
BytesEncryptor encryptor = Encryptors.standard("password", "5c0744940b5c369b");
byte[] result = encryptor.encrypt("text".getBytes("UTF-8"));
assertThat(result).isNotNull();
assertThat(new String(result).equals("text")).isFalse();
assertThat(new String(encryptor.decrypt(result))).isEqualTo("text");
assertThat(new String(result)).isNotEqualTo(
new String(encryptor.encrypt("text".getBytes())));
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void stronger() throws Exception {
CryptoAssumptions.assumeGCMJCE();
BytesEncryptor encryptor = Encryptors.stronger("password", "5c0744940b5c369b");
byte[] result = encryptor.encrypt("text".getBytes("UTF-8"));
assertThat(result).isNotNull();
assertThat(new String(result).equals("text")).isFalse();
assertThat(new String(encryptor.decrypt(result))).isEqualTo("text");
assertThat(new String(result)).isNotEqualTo(
new String(encryptor.encrypt("text".getBytes())));
}
代码示例来源:origin: apache/geode
@Test
public void testToByteArray() throws IOException {
final byte[] expected = new byte[] {(byte) 0xCA, (byte) 0xFE, (byte) 0xBA, (byte) 0xBE};
final byte[] actual = IOUtils.toByteArray(new ByteArrayInputStream(expected));
assertThat(actual).isNotNull();
assertThat(actual.length).isEqualTo(expected.length);
assertThat(actual).isEqualTo(expected);
}
代码示例来源:origin: apache/geode
@Test
public void testObjectSerializationWithClassLoader() throws IOException, ClassNotFoundException {
final BigDecimal pi = new BigDecimal(Math.PI);
final byte[] piBytes = IOUtils.serializeObject(pi);
assertThat(piBytes).isNotNull();
assertThat(piBytes.length != 0).isTrue();
final Object piObj =
IOUtils.deserializeObject(piBytes, IOUtilsJUnitTest.class.getClassLoader());
assertThat(piObj).isInstanceOf(BigDecimal.class);
assertThat(piObj).isEqualTo(pi);
}
代码示例来源:origin: apache/geode
@Test
public void testObjectSerialization() throws IOException, ClassNotFoundException {
final Calendar now = Calendar.getInstance();
assertThat(now).isNotNull();
final byte[] nowBytes = IOUtils.serializeObject(now);
assertThat(nowBytes).isNotNull();
assertThat(nowBytes.length != 0).isTrue();
final Object nowObj = IOUtils.deserializeObject(nowBytes);
assertThat(nowObj).isInstanceOf(Calendar.class);
assertThat(((Calendar) nowObj).getTimeInMillis()).isEqualTo(now.getTimeInMillis());
}
代码示例来源:origin: apache/geode
@Test
public void serializeToBlobMapReturnsBytesOfMap() throws Exception {
byte[] bytes = serializeToBlob(this.mapWithTwoEntries);
assertThat(bytes).isNotNull().isEqualTo(this.bytesOfMap);
}
代码示例来源:origin: line/armeria
@Test
public void testWithKeySelector() {
final KafkaStructuredLoggingServiceExposed service = new KafkaStructuredLoggingServiceExposed(
producer, (res, log) -> log.name.getBytes(), false);
final SimpleStructuredLog log = new SimpleStructuredLog("kawamuray");
service.writeLog(null, log);
verify(producer, times(1)).send(captor.capture(), any(Callback.class));
final ProducerRecord<byte[], SimpleStructuredLog> record = captor.getValue();
assertThat(record.key()).isNotNull();
assertThat(new String(record.key())).isEqualTo(log.name);
assertThat(record.value()).isEqualTo(log);
}
代码示例来源:origin: spring-io/initializr
@Test
void downloadStarter() {
byte[] body = getRestTemplate().getForObject(createUrl("starter.zip"),
byte[].class);
assertThat(body).isNotNull();
assertThat(body.length).isGreaterThan(100);
}
代码示例来源:origin: apache/geode
@Test
public void serializeToBlobWithNullReturnsBytesOfNull() throws Exception {
byte[] bytes = serializeToBlob(null);
assertThat(bytes).isNotNull().isEqualTo(this.bytesOfNull);
}
代码示例来源:origin: spring-projects/spring-security
@Test
public void constructorWhenCreatedThenIsSerializableAndDeserializable() {
OAuth2AccessToken accessToken = new OAuth2AccessToken(
TOKEN_TYPE, TOKEN_VALUE, ISSUED_AT, EXPIRES_AT, SCOPES);
byte[] serialized = SerializationUtils.serialize(accessToken);
accessToken = (OAuth2AccessToken) SerializationUtils.deserialize(serialized);
assertThat(serialized).isNotNull();
assertThat(accessToken.getTokenType()).isEqualTo(TOKEN_TYPE);
assertThat(accessToken.getTokenValue()).isEqualTo(TOKEN_VALUE);
assertThat(accessToken.getIssuedAt()).isEqualTo(ISSUED_AT);
assertThat(accessToken.getExpiresAt()).isEqualTo(EXPIRES_AT);
assertThat(accessToken.getScopes()).isEqualTo(SCOPES);
}
}
代码示例来源:origin: apache/geode
@Test
public void serializeMapToStreamWritesMapAsBytes() throws Exception {
HeapDataOutputStream hdos = createHeapDataOutputStream();
serializeTo(this.mapWithTwoEntries, hdos);
assertThat(hdos.toByteArray()).isNotNull().isEqualTo(bytesOfMap);
}
代码示例来源:origin: apache/geode
@Test
public void serializeNullToStreamWritesNullAsBytes() throws Exception {
HeapDataOutputStream hdos = createHeapDataOutputStream();
serializeTo(null, hdos);
assertThat(hdos.toByteArray()).isNotNull().isEqualTo(this.bytesOfNull);
}
代码示例来源:origin: apache/geode
@Test
public void dataSerializes() throws Exception {
EvictionAttributesImpl evictionAttributes = new EvictionAttributesImpl();
byte[] bytes = BlobHelper.serializeToBlob(evictionAttributes);
assertThat(bytes).isNotNull().isNotEmpty();
assertThat(BlobHelper.deserializeBlob(bytes)).isNotSameAs(evictionAttributes)
.isInstanceOf(EvictionAttributesImpl.class);
}
代码示例来源:origin: apache/geode
@Test
public void dataSerializes() throws Exception {
PartitionRegionConfig config = new PartitionRegionConfig(prId, path, partitionAttributes, scope,
evictionAttributes, regionIdleTimeout, regionTimeToLive, entryIdleTimeout, entryTimeToLive,
gatewaySenderIds);
byte[] bytes = BlobHelper.serializeToBlob(config);
assertThat(bytes).isNotNull().isNotEmpty();
assertThat(BlobHelper.deserializeBlob(bytes)).isNotSameAs(config)
.isInstanceOf(PartitionRegionConfig.class);
}
代码示例来源:origin: apache/geode
@Test
public void serializes() throws Exception {
EvictionAttributesImpl evictionAttributes = new EvictionAttributesImpl();
byte[] bytes = SerializationUtils.serialize(evictionAttributes);
assertThat(bytes).isNotNull().isNotEmpty();
assertThat((EvictionAttributesImpl) SerializationUtils.deserialize(bytes))
.isNotSameAs(evictionAttributes)
.isInstanceOf(EvictionAttributesImpl.class);
}
}
代码示例来源:origin: apache/geode
@Ignore("GEODE-4812")
@Test
public void serializes() throws Exception {
PartitionRegionConfig config = new PartitionRegionConfig();
byte[] bytes = SerializationUtils.serialize(config);
assertThat(bytes).isNotNull().isNotEmpty();
assertThat((PartitionRegionConfig) SerializationUtils.deserialize(bytes)).isNotSameAs(config)
.isInstanceOf(PartitionRegionConfig.class);
}
}
代码示例来源:origin: spring-projects/spring-kafka
@Test
public void testReserializedNonTrusted() {
DefaultKafkaHeaderMapper mapper = new DefaultKafkaHeaderMapper();
Message<String> message = MessageBuilder.withPayload("foo")
.setHeader("fix", new Foo())
.build();
RecordHeaders recordHeaders = new RecordHeaders();
mapper.fromHeaders(message.getHeaders(), recordHeaders);
assertThat(recordHeaders.toArray().length).isEqualTo(2); // 1 + json_types
Map<String, Object> headers = new HashMap<>();
mapper.toHeaders(recordHeaders, headers);
assertThat(headers.get("fix")).isInstanceOf(NonTrustedHeaderType.class);
NonTrustedHeaderType ntht = (NonTrustedHeaderType) headers.get("fix");
assertThat(ntht.getHeaderValue()).isNotNull();
assertThat(ntht.getUntrustedType()).isEqualTo(Foo.class.getName());
assertThat(headers).hasSize(1);
recordHeaders = new RecordHeaders();
mapper.fromHeaders(new MessageHeaders(headers), recordHeaders);
headers = new HashMap<>();
mapper.toHeaders(recordHeaders, headers);
assertThat(headers.get("fix")).isInstanceOf(NonTrustedHeaderType.class);
ntht = (NonTrustedHeaderType) headers.get("fix");
assertThat(ntht.getHeaderValue()).isNotNull();
assertThat(ntht.getUntrustedType()).isEqualTo(Foo.class.getName());
mapper.addTrustedPackages(getClass().getPackage().getName());
headers = new HashMap<>();
mapper.toHeaders(recordHeaders, headers);
assertThat(headers.get("fix")).isInstanceOf(Foo.class);
}
代码示例来源:origin: spring-projects/spring-kafka
assertThat(headers.get("customToString")).isEqualTo("Bar [field=fiz]");
NonTrustedHeaderType ntht = (NonTrustedHeaderType) headers.get("fix");
assertThat(ntht.getHeaderValue()).isNotNull();
assertThat(ntht.getUntrustedType()).isEqualTo(Foo.class.getName());
assertThat(headers).hasSize(8);
代码示例来源:origin: evernote/evernote-sdk-android
protected void testRandomLengthInMemory(DiskBackedByteStore byteStore, int length) throws IOException {
byte[] buffer = createRandomFilledBuffer(length);
byteStore.write(buffer);
assertThat(byteStore.swapped()).isFalse();
assertThat(byteStore.getData()).isNotNull().isEqualTo(buffer);
}
代码示例来源:origin: line/line-bot-sdk-java
@Test
public void parseBytesOrNullTestForEmpty() throws Exception {
// Do
byte[] bytes = BeaconContentUtil.parseBytesOrNull("");
// Verify
assertThat(bytes).isNotNull().isEmpty();
}
内容来源于网络,如有侵权,请联系作者删除!