new Junit rule - duplicate literal within a test method
Brought to you by:
chrismair
new Junit rule - duplicate literal within a test method.
You should create a local variable or constant.
This is a variation on the duplicate literal and number but a little more specific.
passes:
@Test
public void testTestObject() throws Exception {
int eventKey = 111;
int partnerKey = 222;
def x = new MyObject(eventKey, partnerKey);
assertEquals(eventKey, x.y());
assertEquals(eventKey, x.z());
}
fails:
passes:
@Test
public void testTestObject() throws Exception {
def x = new MyObject(111, 222);
assertEquals(111, x.y());
assertEquals(222, x.z());
}