Validating EmptySignature Object Equality in Glide Library
This test suite validates the EmptySignature class in the Glide image loading library, focusing on object equality and hash code consistency. It ensures that empty signatures behave predictably when used as cache keys in Glide’s image loading pipeline.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
bumptech/glide
library/test/src/test/java/com/bumptech/glide/signature/EmptySignatureTest.java
package com.bumptech.glide.signature;
import static org.mockito.Mockito.mock;
import com.bumptech.glide.load.Key;
import com.bumptech.glide.tests.KeyTester;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class EmptySignatureTest {
@Rule public final KeyTester keyTester = new KeyTester();
@Test
public void testEquals() {
keyTester
.addEquivalenceGroup(EmptySignature.obtain(), EmptySignature.obtain())
.addEquivalenceGroup(mock(Key.class))
.addEmptyDigestRegressionTest(EmptySignature.obtain())
.test();
}
}