test_class.declarator: userMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private User userMock;
test_class.type: User
test_class.var_name: userMock
test_class.declarator: otherUserMock
test_class.modifier: @Mock
      private
test_class.original_string: @Mock
      private User otherUserMock;
test_class.type: User
test_class.var_name: otherUserMock
test_class.declarator: clock
test_class.modifier: private
test_class.original_string: private Clock clock;
test_class.type: Clock
test_class.var_name: clock
test_class.file: backend/project-board/src/test/java/de/adesso/projectboard/base/access/persistence/AccessIntervalTest.java
test_class.identifier: AccessIntervalTest
test_case.body: @Test
      public void equalsReturnsFalseForDifferentIds() {
          // given
          var accessIntervalId = 1L;
          var otherAccessIntervalId = 2L;
          var userId = "user";
          var startTime = LocalDateTime.now(clock);
          var endTime = LocalDateTime.now(clock).plus(1L, ChronoUnit.DAYS);
  
          given(userMock.getId()).willReturn(userId);
  
          var accessInterval = new AccessInterval(userMock, startTime, endTime);
          accessInterval.id = accessIntervalId;
  
          var otherAccessInterval = new AccessInterval(userMock, startTime, endTime);
          otherAccessInterval.id = otherAccessIntervalId;
  
          // when
          boolean actualEquals = accessInterval.equals(otherAccessInterval);
  
          // then
          assertThat(actualEquals).isFalse();
      }
test_case.class_method_signature: AccessIntervalTest.equalsReturnsFalseForDifferentIds()
test_case.full_signature: @Test public void equalsReturnsFalseForDifferentIds()
test_case.identifier: equalsReturnsFalseForDifferentIds
test_case.invocations: now plus now willReturn given getId equals isFalse assertThat
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void equalsReturnsFalseForDifferentIds()
focal_class.declarator: id
focal_class.modifier: @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
focal_class.original_string: @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      Long id;
focal_class.type: Long
focal_class.var_name: id
focal_class.declarator: user
focal_class.modifier: @ManyToOne
      @JoinColumn(
              name = "USER_ID",
              nullable = false
      )
focal_class.original_string: @ManyToOne
      @JoinColumn(
              name = "USER_ID",
              nullable = false
      )
      User user;
focal_class.type: User
focal_class.var_name: user
focal_class.declarator: startTime
focal_class.modifier: @Column(
              name = "START_TIME",
              nullable = false
      )
focal_class.original_string: @Column(
              name = "START_TIME",
              nullable = false
      )
      LocalDateTime startTime;
focal_class.type: LocalDateTime
focal_class.var_name: startTime
focal_class.declarator: endTime
focal_class.modifier: @Column(
              name = "END_TIME",
              nullable = false
      )
focal_class.original_string: @Column(
              name = "END_TIME",
              nullable = false
      )
      LocalDateTime endTime;
focal_class.type: LocalDateTime
focal_class.var_name: endTime
focal_class.file: backend/project-board/src/main/java/de/adesso/projectboard/base/access/persistence/AccessInterval.java
focal_class.identifier: AccessInterval
focal_class.class_method_signature: AccessInterval.AccessInterval(User user, LocalDateTime startTime, LocalDateTime endTime)
focal_class.full_signature: public  AccessInterval(User user, LocalDateTime startTime, LocalDateTime endTime)
focal_class.identifier: AccessInterval
focal_class.modifiers: public
focal_class.parameters: (User user, LocalDateTime startTime, LocalDateTime endTime)
focal_class.signature:  AccessInterval(User user, LocalDateTime startTime, LocalDateTime endTime)
focal_class.class_method_signature: AccessInterval.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: AccessInterval.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_method.body: @Override
      public boolean equals(Object obj) {
          if(this == obj) {
              return true;
          }
  
          if(obj instanceof AccessInterval) {
              AccessInterval other = (AccessInterval) obj;
  
              // only compare the user IDs because of the cyclic reference: User <-> AccessInterval
              boolean userEquals;
              if(Objects.nonNull(this.user) && Objects.nonNull(other.user)) {
                  userEquals = Objects.equals(this.user.getId(), other.user.getId());
              } else {
                  userEquals = Objects.isNull(this.user) && Objects.isNull(other.user);
              }
  
              return userEquals &&
                      Objects.equals(this.id, other.id) &&
                      Objects.equals(this.startTime, other.startTime) &&
                      Objects.equals(this.endTime, other.endTime);
          }
  
          return false;
      }
focal_method.class_method_signature: AccessInterval.equals(Object obj)
focal_method.full_signature: @Override public boolean equals(Object obj)
focal_method.identifier: equals
focal_method.invocations: nonNull nonNull equals getId getId isNull isNull equals equals equals
focal_method.modifiers: @Override public
focal_method.parameters: (Object obj)
focal_method.return: boolean
focal_method.signature: boolean equals(Object obj)