0

Hello So I am debugging into this code by 'step into or even step over' but I face a "The jar of this class file belongs to container 'Junit4' which does not allow modifications too source attachments of it's entries."

when I step into or step over. The code itself is fully functional , maybe it has something to do with eclipse . I am using MacBook Air m1 for my eclipse java.

Line 'assertEquals(u1, u2) is the issue part when I debug . When I step into or step over that line I face the "source attachments ' issue. I have tried reinstalling eclipse multiple times and it does not work. I even tried it on my brother laptops who has the same m1 air as me and it has the same issue as well.

Here is also a picture of the error in eclipse : https://i.stack.imgur.com/hL8RD.jpg

@Test
public void test_unit_03() {
    /*
     * Create three new units with their intended functions and dimensions. 
     */
    Unit u1 = new Unit("Master Bedroom", 14, 9);
    Unit u2 = new Unit("Master Bedroom", 18, 7);
    Unit u3 = new Unit("Master Bedroom", 18, 8);
    Unit u4 = new Unit("Office", 18, 7); 
    
    assertEquals("A unit of 126 square feet (14' wide and 9' long) functioning as Master Bedroom", u1.toString());
    assertEquals("A unit of 126 square feet (18' wide and 7' long) functioning as Master Bedroom", u2.toString());
    assertEquals("A unit of 144 square feet (18' wide and 8' long) functioning as Master Bedroom", u3.toString());
    assertEquals("A unit of 126 square feet (18' wide and 7' long) functioning as Office", u4.toString());
    
    /*
     * Two units are considered equal if their intended functions are the same (case-sensitive)
     *  and the areas (in square feet) are the same (even if the dimensions may be different). 
     */
    assertEquals(u1, u2);
//  assertTrue(u1.equals(u2));
    /* Note. Result of assertNotEquals is just the opposite to assertEquals. */
    assertNotEquals(u1, u3);
    assertNotEquals(u1, u4);
    assertNotEquals(u2, u3);
    assertNotEquals(u2, u4);
    
    /* 
     * The above assertions do not cover all cases of the equals method as discussed in the lecture.
     * Your implementation of the overridden equals method should cover them.    
     */
}
Jeris
  • 1
  • 2
  • Attach the junit4 source for your version. https://stackoverflow.com/a/47785087/2970947 – Elliott Frisch Nov 18 '21 at 17:06
  • I don't have attach source in my issue. as you can see in the image link in my post – Jeris Nov 18 '21 at 17:48
  • The sources are missing in which you will step into so you cannot step into. To step into, you would have to configure the project accordingly to have the sources attached to the bytecode, which you obviously have not done so far. You should have the sources or at least the Javadoc of the libraries used to be able to read the API description. When debugging, stepping into the used libraries only makes sense when you want to know how the library works. – howlger Nov 19 '21 at 08:49
  • @howlger this is code that works on my teacher computer and other computer. It's only not working my on laptop and I tried it on my brother who has the same laptop as me and it does not work for him as well. Also are you able to explain it little bit simpler form because I am noob in eclipse – Jeris Nov 19 '21 at 19:21
  • @ElliottFrisch do you have instruction on how I can do that ? I am really new to eclipse and I had never encountered these issue before on eclipse – Jeris Nov 19 '21 at 19:21
  • Please show your project structure, tell whether this is a plain or Maven or ... Java project and what you have in _Project > Properties: Java Build Path_ tab _Libraries_ with the JUnit node expanded. – howlger Nov 19 '21 at 19:45

0 Answers0