Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Jun 6, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void setValue(final Object value) {

@Override
public boolean test(final Collection<?> input) {
return input.contains(value);
return input != null && input.contains(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2017-2020 Crown Copyright
* Copyright 2017-2022 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -100,6 +100,24 @@ public void shouldRejectEmptySets() {
assertThat(filter).rejects(new HashSet<>());
}

@Test
public void shouldRejectNullLists() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

// When / Then
assertThat(filter).rejects((ArrayList<?>) null);
}

@Test
public void shouldRejectNullSets() {
// Given
final CollectionContains filter = new CollectionContains(VALUE1);

// When / Then
assertThat(filter).rejects((HashSet<?>) null);
}

@Test
public void shouldJsonSerialiseAndDeserialise() throws IOException {
// Given
Expand Down