/** Test of setBurnInIterations method, of class LatentDirichletAllocationVectorGibbsSampler. */
  @Test
  public void testSetBurnInIterations() {
    int burnInIterations = LatentDirichletAllocationVectorGibbsSampler.DEFAULT_BURN_IN_ITERATIONS;
    LatentDirichletAllocationVectorGibbsSampler instance =
        new LatentDirichletAllocationVectorGibbsSampler();
    assertEquals(burnInIterations, instance.getBurnInIterations());

    burnInIterations = 0;
    instance.setBurnInIterations(burnInIterations);
    assertEquals(burnInIterations, instance.getBurnInIterations());

    burnInIterations = 101;
    instance.setBurnInIterations(burnInIterations);
    assertEquals(burnInIterations, instance.getBurnInIterations());

    boolean exceptionThrown = false;
    try {
      instance.setBurnInIterations(-1);
    } catch (IllegalArgumentException e) {
      exceptionThrown = true;
    } finally {
      assertTrue(exceptionThrown);
    }
    assertEquals(burnInIterations, instance.getBurnInIterations());
  }
  /** 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());
  }