public Piece(String key, Object value, Syntax syntax) { validatePair(key, value); Preconditions.checkNotNull(syntax, "syntax == null"); this.key = key; this.value = value; this.syntax = syntax; }
public Kirai put(Piece piece) { Preconditions.checkNotNull(piece, "piece == null"); if (!tags.contains(piece.getKey())) { throw new IllegalArgumentException( "Tag {" + piece.getKey() + "} was not defined in input string"); } pieces.add(piece); return this; }
@Test public void testShouldNotThrowAnyExceptionWhenObjectIsNotNull() { // given Object object = new Object(); // when Preconditions.checkNotNull(object, "object == null"); // then assertThat(object).isNotNull(); // and no exception is thrown } }