Repository: apache/kafka
File: group-coordinator/src/test/java/org/apache/kafka/coordinator/group/streams/StreamsCoordinatorRecordHelpersTest.java (Java)

Code before:
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberRecordNullMember() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberRecord("groupId", null));
        assertEquals("member should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberTombstoneRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberTombstoneRecord(null, "memberId"));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberTombstoneRecordNullMemberId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberTombstoneRecord("groupId", null));
        assertEquals("memberId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupEpochRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMetadataRecord(null, 1, 1, 1, Map.of()));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupEpochTombstoneRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupEpochTombstoneRecord(null));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupTargetAssignmentRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupTargetAssignmentRecord(null, "memberId", mock(TasksTuple.class)));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupTargetAssignmentRecordNullMemberId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupTargetAssignmentRecord("groupId", null, mock(TasksTuple.class)));
        assertEquals("memberId should not be null here", exception.getMessage());
    }

Review comment (suggestion):
nit: should be called testNewStreamsGroupMetadataRecord (sorry, not your change, but while you are at it...)

Code after:
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberRecordNullMember() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberRecord("groupId", null));
        assertEquals("member should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberTombstoneRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberTombstoneRecord(null, "memberId"));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMemberTombstoneRecordNullMemberId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMemberTombstoneRecord("groupId", null));
        assertEquals("memberId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupMetadataRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupMetadataRecord(null, 1, 1, 1, Map.of()));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupEpochTombstoneRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupEpochTombstoneRecord(null));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupTargetAssignmentRecordNullGroupId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupTargetAssignmentRecord(null, "memberId", mock(TasksTuple.class)));
        assertEquals("groupId should not be null here", exception.getMessage());
    }

    @Test
    public void testNewStreamsGroupTargetAssignmentRecordNullMemberId() {
        NullPointerException exception = assertThrows(NullPointerException.class, () ->
            StreamsCoordinatorRecordHelpers.newStreamsGroupTargetAssignmentRecord("groupId", null, mock(TasksTuple.class)));
        assertEquals("memberId should not be null here", exception.getMessage());
    }