remove @Repeat annotation from test

Original commit: elastic/x-pack-elasticsearch@d5414a32e8
This commit is contained in:
uboness 2015-06-19 01:46:32 +02:00
parent d41815ca18
commit fad95315fb
1 changed files with 27 additions and 27 deletions

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch.watcher; package org.elasticsearch.watcher;
import com.carrotsearch.randomizedtesting.annotations.Repeat;
import org.elasticsearch.test.ElasticsearchTestCase; import org.elasticsearch.test.ElasticsearchTestCase;
import org.junit.Test; import org.junit.Test;
@ -18,38 +17,39 @@ import static org.hamcrest.Matchers.is;
public class WatcherVersionTests extends ElasticsearchTestCase { public class WatcherVersionTests extends ElasticsearchTestCase {
@Test @Test
@Repeat(iterations = 100)
public void testStrings() throws Exception { public void testStrings() throws Exception {
boolean beta = randomBoolean(); for (int i = 0; i < 100; i++) {
int buildNumber = beta ? randomIntBetween(0, 49) : randomIntBetween(0, 48); boolean beta = randomBoolean();
int major = randomIntBetween(0, 20); int buildNumber = beta ? randomIntBetween(0, 49) : randomIntBetween(0, 48);
int minor = randomIntBetween(0, 20); int major = randomIntBetween(0, 20);
int revision = randomIntBetween(0, 20); int minor = randomIntBetween(0, 20);
int revision = randomIntBetween(0, 20);
String build = buildNumber == 0 ? "" : String build = buildNumber == 0 ? "" :
beta ? "-beta" + buildNumber : "-rc" + buildNumber; beta ? "-beta" + buildNumber : "-rc" + buildNumber;
String versionName = new StringBuilder() String versionName = new StringBuilder()
.append(major) .append(major)
.append(".").append(minor) .append(".").append(minor)
.append(".").append(revision) .append(".").append(revision)
.append(build).toString(); .append(build).toString();
WatcherVersion version = WatcherVersion.fromString(versionName); WatcherVersion version = WatcherVersion.fromString(versionName);
logger.info("version: {}", versionName); logger.info("version: {}", versionName);
assertThat(version.major, is((byte) major)); assertThat(version.major, is((byte) major));
assertThat(version.minor, is((byte) minor)); assertThat(version.minor, is((byte) minor));
assertThat(version.revision, is((byte) revision)); assertThat(version.revision, is((byte) revision));
if (buildNumber == 0) { if (buildNumber == 0) {
assertThat(version.build, is((byte) 99)); assertThat(version.build, is((byte) 99));
} else if (beta) { } else if (beta) {
assertThat(version.build, is((byte) buildNumber)); assertThat(version.build, is((byte) buildNumber));
} else { } else {
assertThat(version.build, is((byte) (buildNumber + 50))); assertThat(version.build, is((byte) (buildNumber + 50)));
}
assertThat(version.number(), equalTo(versionName));
} }
assertThat(version.number(), equalTo(versionName));
} }
} }