Skip to content

Commit cde7e59

Browse files
authored
Update MRUCacheTest.java
1 parent 7d27c1d commit cde7e59

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

src/test/java/com/thealgorithms/datastructures/caches/MRUCacheTest.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -124,37 +124,4 @@ public void testEmptyCacheBehavior() {
124124
mruCache.put(1, 10);
125125
assertEquals(10, mruCache.get(1));
126126
}
127-
128-
@Test
129-
public void capacityValidation() {
130-
// Check that an exception is thrown for invalid capacities
131-
Exception exception = null;
132-
133-
// Testing for zero capacity
134-
try {
135-
new MRUCache<>(0); // Should throw an exception
136-
// If no exception is thrown, we should fail the test
137-
fail("Expected IllegalArgumentException for capacity 0");
138-
} catch (IllegalArgumentException e) {
139-
exception = e; // Store the exception if caught
140-
}
141-
142-
// Ensure exception is not null and check the message
143-
assertNotNull(exception, "Expected IllegalArgumentException for capacity 0");
144-
assertEquals("Capacity must be greater than 0!", exception.getMessage());
145-
146-
// Resetting exception for the next test
147-
// Testing for negative capacity
148-
try {
149-
new MRUCache<>(-1); // Should throw an exception
150-
// If no exception is thrown, we should fail the test
151-
fail("Expected IllegalArgumentException for capacity -1");
152-
} catch (IllegalArgumentException e) {
153-
exception = e; // Store the exception if caught
154-
}
155-
156-
// Ensure exception is not null and check the message
157-
assertNotNull(exception, "Expected IllegalArgumentException for capacity -1");
158-
assertEquals("Capacity must be greater than 0!", exception.getMessage());
159-
}
160127
}

0 commit comments

Comments
 (0)