/** Test of setAlpha method, of class LatentDirichletAllocationVectorGibbsSampler. */
  @Test
  public void testSetAlpha() {
    double alpha = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_ALPHA;
    LatentDirichletAllocationVectorGibbsSampler instance =
        new LatentDirichletAllocationVectorGibbsSampler();
    assertEquals(alpha, instance.getAlpha(), 0.0);

    alpha = 1.1;
    instance.setAlpha(alpha);
    assertEquals(alpha, instance.getAlpha(), 0.0);

    boolean exceptionThrown = false;
    try {
      instance.setAlpha(0.0);
    } catch (IllegalArgumentException e) {
      exceptionThrown = true;
    } finally {
      assertTrue(exceptionThrown);
    }
    assertEquals(alpha, instance.getAlpha(), 0.0);

    exceptionThrown = false;
    try {
      instance.setAlpha(-0.1);
    } catch (IllegalArgumentException e) {
      exceptionThrown = true;
    } finally {
      assertTrue(exceptionThrown);
    }
    assertEquals(alpha, instance.getAlpha(), 0.0);
  }
  /** Test of constructors of class LatentDirichletAllocationVectorGibbsSampler. */
  @Test
  public void testConstructors() {
    int topicCount = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_TOPIC_COUNT;
    double alpha = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_ALPHA;
    double beta = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_BETA;
    int maxIterations = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_MAX_ITERATIONS;
    int burnInIterations = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_BURN_IN_ITERATIONS;
    int iterationsPerSample =
        LatentDirichletAllocationVectorGibbsSampler.DEFAULT_ITERATIONS_PER_SAMPLE;

    LatentDirichletAllocationVectorGibbsSampler instance =
        new LatentDirichletAllocationVectorGibbsSampler();
    assertEquals(topicCount, instance.getTopicCount());
    assertEquals(alpha, instance.getAlpha(), 0.0);
    assertEquals(beta, instance.getBeta(), 0.0);
    assertEquals(maxIterations, instance.getMaxIterations());
    assertEquals(burnInIterations, instance.getBurnInIterations());
    assertEquals(iterationsPerSample, instance.getIterationsPerSample());
    assertNotNull(instance.getRandom());

    topicCount = 1 + random.nextInt(100);
    alpha = random.nextDouble() * 10.0;
    beta = random.nextDouble() * 10.0;
    maxIterations = 1 + random.nextInt(100000);
    burnInIterations = random.nextInt(1000);
    iterationsPerSample = random.nextInt(100);
    instance =
        new LatentDirichletAllocationVectorGibbsSampler(
            topicCount, alpha, beta, maxIterations, burnInIterations, iterationsPerSample, random);
    assertEquals(topicCount, instance.getTopicCount());
    assertEquals(alpha, instance.getAlpha(), 0.0);
    assertEquals(beta, instance.getBeta(), 0.0);
    assertEquals(maxIterations, instance.getMaxIterations());
    assertEquals(burnInIterations, instance.getBurnInIterations());
    assertEquals(iterationsPerSample, instance.getIterationsPerSample());
    assertSame(random, instance.getRandom());
  }