Skip to content
Snippets Groups Projects
Commit 03024c96 authored by Andrea Burattin's avatar Andrea Burattin
Browse files

Improved code quality

parent fbdc861e
No related branches found
No related tags found
No related merge requests found
package beamline.tests; package beamline.tests;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Random; import java.util.Random;
import java.util.UUID; import java.util.UUID;
...@@ -48,15 +47,23 @@ public class ResponsesTest { ...@@ -48,15 +47,23 @@ public class ResponsesTest {
assertEquals(df, df2); assertEquals(df, df2);
assertNotEquals(df, df3); assertNotEquals(df, df3);
assertNotEquals(null, df); assertNotEquals(null, df);
assertNotEquals("-", df);
assertEquals(df, df);
assertTrue(df.hashCode() == df2.hashCode());
assertFalse(df.hashCode() == df3.hashCode());
assertEquals("c1", df.getCaseId()); assertEquals("c1", df.getCaseId());
} }
@Test
public void test_equals() throws EventException {
BEvent e21 = BEvent.create("p", "a", "c1");
BEvent e22 = BEvent.create("p", "b", "c1");
BEvent e23 = BEvent.create("p", "a", "c2");
BEvent e24 = BEvent.create("p", "b", "c2");
DirectlyFollowsRelation df = new DirectlyFollowsRelation(e21, e22);
DirectlyFollowsRelation df2 = new DirectlyFollowsRelation(e23, e24);
assertThat(df).isEqualTo(df).hasSameHashCodeAs(df2);
}
@Test @Test
public void string_tests() { public void string_tests() {
String unique = UUID.randomUUID().toString(); String unique = UUID.randomUUID().toString();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment