Back to project page RobitDroid.
The source code is released under:
Copyright (c) 2011 Kenny Meyer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Softwa...
If you think the Android project RobitDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.robitdroid.robit; //from www .j a v a 2s.com import org.junit.Before; import org.junit.Test; import java.util.ArrayList; import static org.junit.Assert.assertEquals; /** * Author: Kenny Meyer <knny.myer@gmail.com> * Date: 11/9/11 * Time: 4:08 PM */ public class GeneratorTest { private Generator generator; @Before public void setUp() throws Exception { this.generator = Generator.getInstance(); } @Test public void testGenerateNumbersWhereRandom_bitEquals0() { this.generator.setRandom_bit(0); ArrayList numbers = this.generator.generateNumbers(9); ArrayList result = new ArrayList(); for (int i = 1; i <= 9; i++) { if (i % 2 == 0) { result.add(i); } else { result.add(0); } } assertEquals(numbers.size(), 9); assertEquals(numbers, result); } @Test public void testGenerateNumbersWhereRandom_bitEquals1() { this.generator.setRandom_bit(1); ArrayList numbers = this.generator.generateNumbers(9); ArrayList result = new ArrayList(); for (int i = 1; i <= 9; i++) { if (i % 2 != 0) { result.add(i); } else { result.add(0); } } assertEquals(numbers.size(), 9); assertEquals(numbers, result); } }