/
NikolayIvkin
/
tutorials1
Обзор
Документация
Войти
/
NikolayIvkin
/
tutorials1
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
libraries-2/src/test/java/com/baeldung/immutable/ImmutablePersonUnitTest.java
34 строки
962 B
vunamtien
[BAEL-117562] Move some article links to libraries-2 (#17475)
29 авг 2024, 10:31
Не верифицирован
29 авг 2024, 10:31
ba1748b
Код
Авторство
О чём код?
package com.baeldung.immutable; import org.junit.Ignore; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.mutabilitydetector.unittesting.MutabilityAssert.assertImmutable; public class ImmutablePersonUnitTest { /** * commenting the test case, As after upgrading to java 11 * assertImmutable is giving exception. Raised the issue to Mutability support team * https://github.com/MutabilityDetector/MutabilityDetector/issues/196 */ @Ignore @Test public void whenModifying_shouldCreateNewInstance() throws Exception { final ImmutablePerson john = ImmutablePerson.builder() .age(42) .name("John") .build(); final ImmutablePerson john43 = john.withAge(43); assertThat(john) .isNotSameAs(john43); assertThat(john.getAge()) .isEqualTo(42); assertImmutable(ImmutablePerson.class); } }