public int sum(Integer a, Integer b) {
	a = Preconditions.checkNotNull(a, "Illegal Argument passed: First parameter is Null.");
	b = Preconditions.checkNotNull(b, "Illegal Argument passed: Second parameter is Null.");

	return a+b;
}

        

public void givenNullString_whenCheckNotNullWithMessage_throwsException () {
    String nullObject = null;
    String message = "Please check the Object supplied, its null!";
  
    assertThatThrownBy(() -> Preconditions.checkNotNull(nullObject, message))
      .isInstanceOf(NullPointerException.class)
      .hasMessage(message).hasNoCause();
}

        

public void whenCheckNotNullWithTemplateMessage_throwsException() {
    String nullObject = null;
    String message = "Please check the Object supplied, its %s!";
  
    assertThatThrownBy(
      () -> Preconditions.checkNotNull(nullObject, message, 
        new Object[] { null }))
      .isInstanceOf(NullPointerException.class)
      .hasMessage(message, nullObject).hasNoCause();
}

        

public void testForNonNullArgument(final String parameter)
{
	final String localParameter = checkNotNull(parameter, "Provided parameter is unacceptably null.");
}

        

public void testCheckNotNull_simple_failure() {
	try {
		Preconditions.checkNotNull(null);
		fail("no exception thrown");
	} catch (NullPointerException expected) {
	}
}

        

public SwitchRepresentation(@Nonnull IOFSwitch sw, @Nonnull OFSwitchHandshakeHandler handshakeHandler) {
    Preconditions.checkNotNull(sw, "switch must not be null");
    Preconditions.checkNotNull(handshakeHandler, "handshakeHandler must not be null");

    // IOFSwitch
    this.buffers = sw.getBuffers();
    this.capabilities = sw.getCapabilities();
    this.tables = sw.getNumTables();
    this.inetAddress = sw.getInetAddress();
    this.sortedPorts = sw.getSortedPorts();
    this.isConnected = sw.isConnected();
    this.connectedSince = sw.getConnectedSince();
    this.dpid = sw.getId();
    this.attributes = sw.getAttributes();
    this.isActive = sw.isActive();

    // OFSwitchHandshakeHandler
    this.connections = handshakeHandler.getConnections();
    this.handshakeState = handshakeHandler.getState();
    this.quarantineReason = handshakeHandler.getQuarantineReason();
}

        

public RowKey buildRowKey(StatEventKey statEventKey) {
    Preconditions.checkNotNull(statEventKey);

    long timeMs = statEventKey.getTimeMs();

    final byte[] partialTimestamp = buildPartialTimestamp(timeMs);
    final byte[] rollupBitMask = statEventKey.getRollupMask().asBytes();
    List<RowKeyTagValue> rowKeyTagValues = statEventKey.getTagValues().stream()
            .map(tagValue -> new RowKeyTagValue(tagValue.getTag(), tagValue.getValue()))
            .collect(Collectors.toList());

    TimeAgnosticRowKey timeAgnosticRowKey = new TimeAgnosticRowKey(
            statEventKey.getStatUuid(),
            rollupBitMask,
            rowKeyTagValues);

    //timeMs is already rounded to the column interval
    return new RowKey(timeAgnosticRowKey, partialTimestamp);
}

        

public final byte[] toByteArray(boolean shrink) {
  ByteBuffer buffer = ByteBuffer.allocate(size());
  buffer.order(ByteOrder.LITTLE_ENDIAN);
  buffer.putShort((short) headerSize());
  buffer.putShort((short) flags());
  buffer.putInt(keyIndex());
  if (isComplex()) {
    buffer.putInt(parentEntry());
    buffer.putInt(values().size());
    for (Map.Entry<Integer, ResourceValue> entry : values().entrySet()) {
      buffer.putInt(entry.getKey());
      buffer.put(entry.getValue().toByteArray(shrink));
    }
  } else {
    ResourceValue value = value();
    Preconditions.checkNotNull(value, "A non-complex TypeChunk entry must have a value.");
    buffer.put(value.toByteArray());
  }
  return buffer.array();
}

        

public void cancelDelegationToken(URL url, Token token, String doAsUser)
    throws IOException {
  Preconditions.checkNotNull(url, "url");
  Preconditions.checkNotNull(token, "token");
  Preconditions.checkNotNull(token.delegationToken,
      "No delegation token available");
  try {
    ((KerberosDelegationTokenAuthenticator) getAuthenticator()).
        cancelDelegationToken(url, token, token.delegationToken, doAsUser);
  } finally {
    token.delegationToken = null;
  }
}

        

public static final String join(final String... parts) {
  final StringBuilder sb = new StringBuilder();
  for (final String part:parts) {
    Preconditions.checkNotNull(part, "parts cannot contain null");
    if (!Strings.isNullOrEmpty(part)) {
      sb.append(part).append("/");
    }
  }
  if (sb.length() > 0) {
    sb.deleteCharAt(sb.length() - 1);
  }
  final String path = sb.toString();
  return normalize(path);
}        
main