cajon-plugin/src/test/resources/inspections/GuavaOptional/WithoutPriorGuavaImportBefore.java
chrisly42 db02f7fb93 New AssertThatInvertedBooleanCondition inspection that will remove inverted boolean expressions inside assertThat().
Renamed a few inspections to better/shorter names (and fixed file and directory names accordingly).
2019-04-20 18:40:38 +02:00

27 lines
873 B
Java

import com.google.common.base.Optional;
import static org.assertj.core.api.Assertions.assertThat;
public class GuavaOptional {
private void guavaOptional() {
Optional<String> opt = Optional.absent();
assertThat(opt).isEqualTo(Optional.of("foo"));
assertThat(opt).isEqualTo(Optional.fromNullable("foo"));
assertThat(opt).isNotEqualTo(Optional.of("foo"));
assertThat(opt).isNotEqualTo(Optional.fromNullable("foo"));
assertThat(opt.isPresent()).isTrue();
assertThat(opt.isPresent()).isFalse();
assertThat(opt.get()).isEqualTo("foo");
assertThat(opt.get()).isSameAs("foo");
assertThat(opt.get()).isNotEqualTo("foo");
assertThat(opt.get()).isNotSameAs("foo");
assertThat(opt).isEqualTo(Optional.absent());
assertThat(opt).isNotEqualTo(Optional.absent());
}
}