All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.microsoft.bot.builder.core.BotAssert Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
package com.microsoft.bot.builder.core;

import com.microsoft.bot.schema.models.Activity;
import com.microsoft.bot.schema.models.ConversationReference;

import java.util.ArrayList;

/// 
/// Provides methods for debugging Bot Builder code.
/// 
public class BotAssert
{
    /// 
    /// Checks that an activity object is not null.
    /// 
    /// The activity object.
    /// 
    ///  is null.
    public static void ActivityNotNull(Activity activity)
    {
        if (activity == null)
            throw new IllegalArgumentException ("Activity");
    }

    /// 
    /// Checks that a context object is not null.
    /// 
    /// The context object.
    /// 
    ///  is null.
    public static void ContextNotNull(TurnContext context)
    {
        if (context == null)
            throw new IllegalArgumentException ("TurnContext");
    }

    /// 
    /// Checks that a conversation reference object is not null.
    /// 
    /// The conversation reference object.
    /// 
    ///  is null.
    public static void ConversationReferenceNotNull(ConversationReference reference)
    {
        if (reference == null)
            throw new IllegalArgumentException ("ConversationReference");
    }

    /// 
    /// Checks that an activity collection is not null.
    /// 
    /// The activities.
    /// 
    ///  is null.
    public static void ActivityListNotNull(ArrayList activities)
    {
        if (activities == null)
            throw new NullPointerException("List");
    }

    /// 
    /// Checks that a middleware object is not null.
    /// 
    /// The middleware object.
    /// 
    ///  is null.
    public static void MiddlewareNotNull(Middleware middleware)
    {
        if (middleware == null)
            throw new NullPointerException("Middleware");
    }

    /// 
    /// Checks that a middleware collection is not null.
    /// 
    /// The middleware.
    /// 
    ///  is null.
    public static void MiddlewareNotNull(ArrayList middleware)
    {
        if (middleware == null)
            throw new NullPointerException("List");
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy