org.hamcrest.core.IsNot Java Examples

The following examples show how to use org.hamcrest.core.IsNot. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Ed25519GroupElementTest.java    From symbol-sdk-java with Apache License 2.0 6 votes vote down vote up
@Test
public void equalsOnlyReturnsTrueForEquivalentObjects() {
    // Arrange:
    final Ed25519GroupElement g1 = MathUtils.getRandomGroupElement();
    final Ed25519GroupElement g2 = MathUtils.toRepresentation(g1, CoordinateSystem.P2);
    final Ed25519GroupElement g3 = MathUtils.toRepresentation(g1, CoordinateSystem.CACHED);
    final Ed25519GroupElement g4 = MathUtils.toRepresentation(g1, CoordinateSystem.P1xP1);
    final Ed25519GroupElement g5 = MathUtils.getRandomGroupElement();

    // Assert
    MatcherAssert.assertThat(g2, IsEqual.equalTo(g1));
    MatcherAssert.assertThat(g3, IsEqual.equalTo(g1));
    MatcherAssert.assertThat(g1, IsEqual.equalTo(g4));
    MatcherAssert.assertThat(g1, IsNot.not(IsEqual.equalTo(g5)));
    MatcherAssert.assertThat(g2, IsNot.not(IsEqual.equalTo(g5)));
    MatcherAssert.assertThat(g3, IsNot.not(IsEqual.equalTo(g5)));
    MatcherAssert.assertThat(g5, IsNot.not(IsEqual.equalTo(g4)));
}
 
Example #2
Source File: ConfigurationDerivation.java    From ehcache3 with Apache License 2.0 6 votes vote down vote up
@Test
public void withService() {
  Configuration configuration = ConfigurationBuilder.newConfigurationBuilder()
    .withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.heap(10)))
    .build();

  //tag::withService[]
  Configuration withThrowingStrategy = configuration.derive()
    .updateCache("cache", existing -> existing.withService(
      new DefaultResilienceStrategyConfiguration(new ThrowingResilienceStrategy<>())
    ))
    .build();
  //end::withService[]


  Assert.assertThat(configuration.getServiceCreationConfigurations(), IsNot.not(IsCollectionContaining.hasItem(
    IsInstanceOf.instanceOf(DefaultResilienceStrategyConfiguration.class))));

  DefaultResilienceStrategyConfiguration resilienceStrategyConfiguration =
    ServiceUtils.findSingletonAmongst(DefaultResilienceStrategyConfiguration.class,
      withThrowingStrategy.getCacheConfigurations().get("cache").getServiceConfigurations());
  Assert.assertThat(resilienceStrategyConfiguration.getInstance(), IsInstanceOf.instanceOf(ThrowingResilienceStrategy.class));
}
 
Example #3
Source File: ConfigurationDerivation.java    From ehcache3 with Apache License 2.0 6 votes vote down vote up
@Test
public void withServiceCreation() {
  Configuration configuration = ConfigurationBuilder.newConfigurationBuilder()
    .withCache("cache", CacheConfigurationBuilder.newCacheConfigurationBuilder(Long.class, String.class, ResourcePoolsBuilder.heap(10)))
    .build();

  //tag::withServiceCreation[]
  Configuration withBoundedThreads = configuration.derive()
    .withService(new PooledExecutionServiceConfiguration()
      .addDefaultPool("default", 1, 16))
    .build();
  //end::withServiceCreation[]

  Assert.assertThat(configuration.getServiceCreationConfigurations(), IsNot.not(IsCollectionContaining.hasItem(IsInstanceOf.instanceOf(PooledExecutionServiceConfiguration.class))));
  PooledExecutionServiceConfiguration serviceCreationConfiguration = ServiceUtils.findSingletonAmongst(PooledExecutionServiceConfiguration.class, withBoundedThreads.getServiceCreationConfigurations());
  Assert.assertThat(serviceCreationConfiguration.getDefaultPoolAlias(), Is.is("default"));
  Assert.assertThat(serviceCreationConfiguration.getPoolConfigurations().keySet(), IsIterableContainingInAnyOrder.containsInAnyOrder("default"));
  PooledExecutionServiceConfiguration.PoolConfiguration pool = serviceCreationConfiguration.getPoolConfigurations().get("default");
  Assert.assertThat(pool.minSize(), Is.is(1));
  Assert.assertThat(pool.maxSize(), Is.is(16));
}
 
Example #4
Source File: UVFEncoderTest.java    From arctic-sea with Apache License 2.0 6 votes vote down vote up
@Test
public void shouldNotEncodeUnitOfMeasurementForCountObservations() throws EncodingException, NoSuchElementException, OwsExceptionReport {
    OmObservation omObservation = responseToEncode.getObservationCollection().next();
    omObservation.getObservationConstellation().
            setObservationType(OmConstants.OBS_TYPE_COUNT_OBSERVATION);
    Time phenTime = new TimeInstant(new Date(UTC_TIMESTAMP_1));
    omObservation.setValue(new SingleObservationValue<>(phenTime,
            new CountValue(52)));
    ((OmObservableProperty)omObservation.getObservationConstellation()
            .getObservableProperty()).setUnit(null);
    responseToEncode.setObservationCollection(ObservationStream.of(omObservation));

    final String[] actual = getResponseString();
    final String expected = "$sb Mess-Einheit: " + unit;

    assertThat(Arrays.asList(actual), IsNot.not(CoreMatchers.hasItems(expected)));
}
 
Example #5
Source File: CloseableInputStreamTest.java    From cactoos-http with MIT License 6 votes vote down vote up
@Test
public void doesNotCloseTheStream() throws Exception {
    final CloseableInputStream closeable = new CloseableInputStream(
        new DeadInputStream()
    );
    new Assertion<>(
        "must not be marked as closed before close is called",
        closeable.wasClosed(),
        new IsNot<>(new IsTrue())
    ).affirm();
    closeable.close();
    new Assertion<>(
        "must be marked as closed after close is called",
        closeable.wasClosed(),
        new IsTrue()
    ).affirm();
}
 
Example #6
Source File: BlockCipherTest.java    From symbol-sdk-java with Apache License 2.0 6 votes vote down vote up
@Test
void dataEncryptedWithPrivateKeyCanOnlyBeDecryptedByMatchingPublicKey(
) {
    // Arrange:
    final CryptoEngine engine = this.getCryptoEngine();
    final BlockCipher blockCipher1 =
        this.getBlockCipher(KeyPair.random(engine), KeyPair.random(engine));
    final BlockCipher blockCipher2 =
        this.getBlockCipher(KeyPair.random(engine), KeyPair.random(engine));
    final byte[] input = RandomUtils.generateRandomBytes();

    // Act:
    final byte[] encryptedBytes1 = blockCipher1.encrypt(input);
    final byte[] encryptedBytes2 = blockCipher2.encrypt(input);

    // Assert:
    MatcherAssert.assertThat(blockCipher1.decrypt(encryptedBytes1), IsEqual.equalTo(input));
    MatcherAssert
        .assertThat(blockCipher1.decrypt(encryptedBytes2), IsNot.not(IsEqual.equalTo(input)));
    MatcherAssert
        .assertThat(blockCipher2.decrypt(encryptedBytes1), IsNot.not(IsEqual.equalTo(input)));
    MatcherAssert.assertThat(blockCipher2.decrypt(encryptedBytes2), IsEqual.equalTo(input));
}
 
Example #7
Source File: Ed25519EncodedFieldElementTest.java    From symbol-sdk-java with Apache License 2.0 6 votes vote down vote up
@Test
public void hashCodesAreEqualForEquivalentObjects() {
    // Arrange:
    final Ed25519EncodedFieldElement encoded1 = MathUtils.getRandomEncodedFieldElement(32);
    final Ed25519EncodedFieldElement encoded2 = encoded1.decode().encode();
    final Ed25519EncodedFieldElement encoded3 = MathUtils.getRandomEncodedFieldElement(32);
    final Ed25519EncodedFieldElement encoded4 = MathUtils.getRandomEncodedFieldElement(32);

    // Assert:
    MatcherAssert.assertThat(encoded1.hashCode(), IsEqual.equalTo(encoded2.hashCode()));
    MatcherAssert
        .assertThat(encoded1.hashCode(), IsNot.not(IsEqual.equalTo(encoded3.hashCode())));
    MatcherAssert
        .assertThat(encoded1.hashCode(), IsNot.not(IsEqual.equalTo(encoded4.hashCode())));
    MatcherAssert
        .assertThat(encoded3.hashCode(), IsNot.not(IsEqual.equalTo(encoded4.hashCode())));
}
 
Example #8
Source File: PropertiesOfTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void sensesChangesInMap() throws Exception {
    final AtomicInteger size = new AtomicInteger(2);
    final PropertiesOf props = new PropertiesOf(
        new MapOf<>(
            () -> new Repeated<>(
                size.incrementAndGet(), () -> new MapEntry<>(
                    new SecureRandom().nextInt(),
                    1
                )
            )
        )
    );
    new Assertion<>(
        "Must sense the changes in the underlying map",
        props.value().size(),
        new IsNot<>(new IsEqual<>(props.value().size()))
    ).affirm();
}
 
Example #9
Source File: BlockCipherTest.java    From symbol-sdk-java with Apache License 2.0 6 votes vote down vote up
@Test
void dataCanBeEncryptedWithSenderPrivateKeyAndRecipientPublicKey() {
    // Arrange:
    final CryptoEngine engine = this.getCryptoEngine();
    final KeyPair skp = KeyPair.random(engine);
    final KeyPair rkp = KeyPair.random(engine);
    final BlockCipher blockCipher =
        this.getBlockCipher(skp, KeyPair.onlyPublic(rkp.getPublicKey(), engine));
    final byte[] input = RandomUtils.generateRandomBytes();

    // Act:
    final byte[] encryptedBytes = blockCipher.encrypt(input);

    // Assert:
    MatcherAssert.assertThat(encryptedBytes, IsNot.not(IsEqual.equalTo(input)));
}
 
Example #10
Source File: BlockCipherTest.java    From symbol-sdk-java with Apache License 2.0 6 votes vote down vote up
@Test
void encryptedDataCanBeDecrypted() {
    // Arrange:
    final CryptoEngine engine = this.getCryptoEngine();
    final KeyPair kp = KeyPair.random(engine);
    final BlockCipher blockCipher = this.getBlockCipher(kp, kp);
    final byte[] input = RandomUtils.generateRandomBytes();

    // Act:
    final byte[] encryptedBytes = blockCipher.encrypt(input);
    final byte[] decryptedBytes = blockCipher.decrypt(encryptedBytes);

    // Assert:
    MatcherAssert.assertThat(encryptedBytes, IsNot.not(IsEqual.equalTo(decryptedBytes)));
    MatcherAssert.assertThat(decryptedBytes, IsEqual.equalTo(input));
}
 
Example #11
Source File: FuturesTest.java    From jpeek with MIT License 6 votes vote down vote up
@Test
public void testSimpleScenario() throws Exception {
    new Assertion<>(
        "Futures returns Response",
        new Futures(
            (artifact, group) -> input -> new RsPage(
                new RqFake(),
                "wait",
                () -> new IterableOf<>(
                    new XeAppend("group", group),
                    new XeAppend("artifact", artifact)
                )
            )
        ).apply("a", "g").get().apply("test"),
        new IsNot<>(new IsEqual<>(null))
    ).affirm();
}
 
Example #12
Source File: BaseTestRuleBasedAuthorizationPlugin.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testAllPermissionDeniesActionsWhenUserIsNotCorrectRole() {
  SolrRequestHandler handler = new UpdateRequestHandler();
  assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));
  setUserRole("dev", "dev");
  setUserRole("admin", "admin");
  addPermission("all", "admin");
  checkRules(makeMap("resource", "/update",
      "userPrincipal", "dev",
      "requestType", RequestType.UNKNOWN,
      "collectionRequests", "go",
      "handler", new UpdateRequestHandler(),
      "params", new MapSolrParams(singletonMap("key", "VAL2")))
      , FORBIDDEN);

  handler = new PropertiesRequestHandler();
  assertThat(handler, new IsNot<>(new IsInstanceOf(PermissionNameProvider.class)));
  checkRules(makeMap("resource", "/admin/info/properties",
      "userPrincipal", "dev",
      "requestType", RequestType.UNKNOWN,
      "collectionRequests", "go",
      "handler", handler,
      "params", new MapSolrParams(emptyMap()))
      , FORBIDDEN);
}
 
Example #13
Source File: BaseTestRuleBasedAuthorizationPlugin.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Test
public void testAllPermissionAllowsActionsWhenUserHasCorrectRole() {
  SolrRequestHandler handler = new UpdateRequestHandler();
  assertThat(handler, new IsInstanceOf(PermissionNameProvider.class));
  setUserRole("dev", "dev");
  setUserRole("admin", "admin");
  addPermission("all", "dev", "admin");
  checkRules(makeMap("resource", "/update",
      "userPrincipal", "dev",
      "requestType", RequestType.UNKNOWN,
      "collectionRequests", "go",
      "handler", handler,
      "params", new MapSolrParams(singletonMap("key", "VAL2")))
      , STATUS_OK);

  handler = new PropertiesRequestHandler();
  assertThat(handler, new IsNot<>(new IsInstanceOf(PermissionNameProvider.class)));
  checkRules(makeMap("resource", "/admin/info/properties",
      "userPrincipal", "dev",
      "requestType", RequestType.UNKNOWN,
      "collectionRequests", "go",
      "handler", handler,
      "params", new MapSolrParams(emptyMap()))
      , STATUS_OK);
}
 
Example #14
Source File: MapOfTest.java    From cactoos with MIT License 6 votes vote down vote up
@Test
public void sensesChangesInMap() throws Exception {
    final AtomicInteger size = new AtomicInteger(2);
    final Map<Integer, Integer> map = new MapOf<>(
        () -> new Repeated<>(
            size.incrementAndGet(), () -> new MapEntry<>(
                new SecureRandom().nextInt(),
                1
            )
        )
    );
    MatcherAssert.assertThat(
        "Can't sense the changes in the underlying map",
        map.size(),
        new IsNot<>(new IsEqual<>(map.size()))
    );
}
 
Example #15
Source File: IterableOfTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void notEqualsToIterableWithDifferentElements() {
    new Assertion<>(
        "must not equal to Iterable with different elements",
        new IterableOf<>(1, 2),
        new IsNot<>(new IsEqual<>(new IterableOf<>(1, 0)))
    ).affirm();
}
 
Example #16
Source File: TextOfTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void currentZonedDateTimeAsText() throws IOException {
    new Assertion<>(
        "Can't format a ZonedDateTime with ISO format.",
        new TextOf(ZonedDateTime.now()).asString(),
        new IsNot<>(new IsNull<>())
    ).affirm();
}
 
Example #17
Source File: TextEnvelopeTest.java    From cactoos with MIT License 5 votes vote down vote up
/**
 * Test for {@link TextEnvelope#equals(Object)} method. Must assert
 * that the envelope value is not equal another object not being a
 * instance of Text without failing
 */
@Test
public void testDoesNotEqualsNonTextObject() {
    new Assertion<>(
        "Envelope does not match another object which is not a string",
        new TextEnvelopeDummy("is not equals to null"),
        new IsNot<>(
            new IsEqual<>(new Object())
        )
    ).affirm();
}
 
Example #18
Source File: BasicSerializationTest.java    From ehcache3 with Apache License 2.0 5 votes vote down vote up
@Test
public void testPrimitiveClasses() throws ClassNotFoundException {
  StatefulSerializer<Serializable> s = new CompactJavaSerializer<>(null);
  s.init(new TransientStateRepository());

  Class<?>[] out = (Class<?>[]) s.read(s.serialize(PRIMITIVE_CLASSES));

  Assert.assertThat(out, IsNot.not(IsSame.sameInstance(PRIMITIVE_CLASSES)));
  Assert.assertThat(out, IsEqual.equalTo(PRIMITIVE_CLASSES));
}
 
Example #19
Source File: TextOfTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void currentLocalDateTimeAsText() throws IOException {
    new Assertion<>(
        "Can't format a LocalDateTime with ISO format.",
        new TextOf(LocalDateTime.now()).asString(),
        new IsNot<>(new IsNull<>())
    ).affirm();
}
 
Example #20
Source File: CollectionOfTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void differentHashCode() {
    new Assertion<>(
        "Must have different hash code for different entries",
        new CollectionOf<>("a", "b").hashCode(),
        new IsNot<>(new IsEqual<>(new CollectionOf<>("b", "a").hashCode()))
    ).affirm();
}
 
Example #21
Source File: CollectionOfTest.java    From cactoos with MIT License 5 votes vote down vote up
@Test
public void notEqualToCollectionOfDifferentSize() {
    new Assertion<>(
        "Must not equal a collection of different size",
        new CollectionOf<>(),
        new IsNot<>(new IsEqual<>(new CollectionOf<>("b")))
    ).affirm();
}
 
Example #22
Source File: RemoveDeletesValues.java    From cactoos with MIT License 5 votes vote down vote up
@Override
public boolean matchesSafely(final Map<K, V> map) {
    map.remove(this.key);
    MatcherAssert.assertThat(
        "Contains the key/value after remove",
        map,
        new IsNot<>(
            new IsMapContaining<>(
                new IsEqual<>(this.key),
                new IsEqual<>(this.value)
            )
        )
    );
    MatcherAssert.assertThat(
        "Contains the key in #keySet() after remove",
        map.keySet(),
        new IsNot<>(
            new IsCollectionContaining<>(new IsEqual<>(this.key))
        )
    );
    MatcherAssert.assertThat(
        "Contains the value in #values() after remove",
        map.values(),
        new IsNot<>(
            new IsCollectionContaining<>(new IsEqual<>(this.value))
        )
    );
    return true;
}
 
Example #23
Source File: PrivateKeyTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void hashCodesAreEqualForEquivalentObjects() {
    // Arrange:
    final PrivateKey key = new PrivateKey(new BigInteger("2275"));
    final int hashCode = key.hashCode();

    // Assert:
    MatcherAssert
        .assertThat(PrivateKey.fromDecimalString("2275").hashCode(), IsEqual.equalTo(hashCode));
    MatcherAssert.assertThat(
        PrivateKey.fromDecimalString("2276").hashCode(), IsNot.not(IsEqual.equalTo(hashCode)));
    MatcherAssert.assertThat(
        PrivateKey.fromHexString("2275").hashCode(), IsNot.not(IsEqual.equalTo(hashCode)));
}
 
Example #24
Source File: PrivateKeyTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsOnlyReturnsTrueForEquivalentObjects() {
    // Arrange:
    final PrivateKey key = new PrivateKey(new BigInteger("2275"));

    // Assert:
    MatcherAssert.assertThat(PrivateKey.fromDecimalString("2275"), IsEqual.equalTo(key));
    MatcherAssert.assertThat(PrivateKey.fromDecimalString("2276"), IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(PrivateKey.fromHexString("2276"), IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(null, IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(new BigInteger("1235"), IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(PrivateKey.generateRandom(), IsNot.not(IsEqual.equalTo(PrivateKey.fromDecimalString("2275"))));
}
 
Example #25
Source File: PublicKeyTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsOnlyReturnsTrueForEquivalentObjects() {
    // Arrange:
    final PublicKey key = new PublicKey(TEST_BYTES);

    // Assert:
    MatcherAssert.assertThat(new PublicKey(TEST_BYTES), IsEqual.equalTo(key));
    MatcherAssert
        .assertThat(new PublicKey(MODIFIED_TEST_BYTES), IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(null, IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(TEST_BYTES, IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(key, IsNot.not(IsEqual.equalTo("ImNotAPublicKey")));
    MatcherAssert.assertThat(PublicKey.generateRandom(), IsNot.not(IsEqual.equalTo(PublicKey.fromHexString("2275"))));
}
 
Example #26
Source File: PublicKeyTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldBeEquals() {
    // Arrange:
    final PublicKey key1 = PublicKey.fromHexString("227F");
    final PublicKey key2 = PublicKey.fromHexString("227F");
    final PublicKey key3 = PublicKey.fromHexString("327F");

    // Assert:
    MatcherAssert.assertThat(key1, IsEqual.equalTo(key2));
    MatcherAssert.assertThat(key1, IsNot.not(IsEqual.equalTo(key3)));
}
 
Example #27
Source File: UVFEncoderTest.java    From arctic-sea with Apache License 2.0 5 votes vote down vote up
@Test
public void shouldEncodeGetObservationResponse() throws EncodingException {
    BinaryAttachmentResponse encodedResponse = encoder.encode(responseToEncode);

    assertThat(encodedResponse, IsNot.not(CoreMatchers.nullValue()));
    final String[] split = new String(encodedResponse.getBytes()).split("\n");
    assertTrue(split.length >= 10, "Expected >= 10 elements in array, got " + split.length);
}
 
Example #28
Source File: EndToEndEncryptionTest.java    From sync-android with Apache License 2.0 5 votes vote down vote up
@Test
public void jsonDataEncrypted() throws IOException, QueryException {
    File jsonDatabase = new File(datastoreManagerDir
            + File.separator + "EndToEndEncryptionTest"
            + File.separator + "db.sync");

    // Database creation happens in the background, so we need to call a blocking
    // database operation to ensure the database exists on disk before we look at
    // it.

    Query im = this.database.query();
    try {
        im.createJsonIndex(Arrays.<FieldSort>asList(new FieldSort("name"), new FieldSort("age")), null);
    } finally {
        ((QueryImpl)im).close();
    }

    InputStream in = new FileInputStream(jsonDatabase);
    byte[] magicBytesBuffer = new byte[sqlCipherMagicBytes.length];
    int readLength = in.read(magicBytesBuffer);

    assertEquals("Didn't read full buffer", magicBytesBuffer.length, readLength);

    if (dataShouldBeEncrypted) {
        assertThat("SQLite magic bytes found in file that should be encrypted",
                sqlCipherMagicBytes, IsNot.not(IsEqual.equalTo(magicBytesBuffer)));
    } else {
        assertThat("SQLite magic bytes not found in file that should not be encrypted",
                sqlCipherMagicBytes, IsEqual.equalTo(magicBytesBuffer));
    }
}
 
Example #29
Source File: KeyGeneratorTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void generateKeyPairCreatesDifferentInstancesWithDifferentKeys() {
    // Act:
    final KeyPair kp1 = this.getKeyGenerator().generateKeyPair();
    final KeyPair kp2 = this.getKeyGenerator().generateKeyPair();

    // Assert:
    MatcherAssert
        .assertThat(kp2.getPrivateKey(), IsNot.not(IsEqual.equalTo(kp1.getPrivateKey())));
    MatcherAssert
        .assertThat(kp2.getPublicKey(), IsNot.not(IsEqual.equalTo(kp1.getPublicKey())));
}
 
Example #30
Source File: VotingKeyTest.java    From symbol-sdk-java with Apache License 2.0 5 votes vote down vote up
@Test
public void equalsOnlyReturnsTrueForEquivalentObjects() {
    // Arrange:
    final VotingKey key = new VotingKey(TEST_BYTES);

    // Assert:
    MatcherAssert.assertThat(new VotingKey(TEST_BYTES), IsEqual.equalTo(key));
    MatcherAssert
        .assertThat(new VotingKey(MODIFIED_TEST_BYTES), IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(null, IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(TEST_BYTES, IsNot.not(IsEqual.equalTo(key)));
    MatcherAssert.assertThat(key, IsNot.not(IsEqual.equalTo("ImNotAVotingKey")));
}