/** * Verifies that the actual DeploymentResource's resource contains <b>only</b> the given byte elements and nothing else in whatever order. * * @param resource the given elements that should be contained in actual DeploymentResource's resource. * @return this assertion object. * @throws AssertionError if the actual DeploymentResource's resource does not contain all given byte elements and nothing else. */ public S hasOnlyResource(byte... resource) { // check that actual DeploymentResource we want to make assertions on is not null. isNotNull(); // check that given byte varargs is not null. if (resource == null) failWithMessage("Expecting resource parameter not to be null."); // check with standard error message (use overridingErrorMessage before contains to set your own message). Assertions.assertThat(actual.getResource()).containsOnly(resource); // return the current assertion for method chaining return myself; }
@Test public void bytes() { ArrayCoercion coercion = coercion(); CoercionTarget coercionTarget = coercionTarget(byte[].class); assertThat(coercion.isApplicableTo(coercionTarget)).isTrue(); assertThat((byte[]) coercion.coerce(coercionTarget, "45")).containsOnly((byte)45); assertThat((byte[]) coercion.coerce(coercionTarget, "45,127,-127")).containsOnly((byte)45, (byte)127, (byte)-127); }
/** * Verifies that the actual BonitaConfiguration's resourceContent contains <b>only<b> the given byte elements and nothing else in whatever order. * * @param resourceContent the given elements that should be contained in actual BonitaConfiguration's resourceContent. * @return this assertion object. * @throws AssertionError if the actual BonitaConfiguration's resourceContent does not contain all given byte elements and nothing else. */ public BonitaConfigurationAssert hasOnlyResourceContent(byte... resourceContent) { // check that actual BonitaConfiguration we want to make assertions on is not null. isNotNull(); // check that given byte varargs is not null. if (resourceContent == null) failWithMessage("Expecting resourceContent parameter not to be null."); // check with standard error message (use overridingErrorMessage before contains to set your own message). Assertions.assertThat(actual.getResourceContent()).containsOnly(resourceContent); // return the current assertion for method chaining return this; }
queue.raf.seek(HEADER_LENGTH); queue.raf.readFully(data, 0, firstElementPadding); assertThat(data).containsOnly((byte) 0x00); queue.raf.seek(endOfLastElement); queue.raf.readFully(data, 0, readLength); assertThat(data).containsOnly((byte) 0x00);