Created
December 20, 2013 16:12
-
-
Save trishagee/8057097 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void shouldGenerateIndexNameForSimpleKey() { | |
final Index index = new Index("x"); | |
assertEquals("x_1", index.getName()); | |
} | |
@Test | |
public void shouldGenerateIndexNameForKeyOrderedAscending() { | |
final Index index = new Index("x", OrderBy.ASC); | |
assertEquals("x_1", index.getName()); | |
} | |
@Test | |
public void shouldGenerateIndexNameForKeyOrderedDescending() { | |
final Index index = new Index("x", OrderBy.DESC); | |
assertEquals("x_-1", index.getName()); | |
} | |
@Test | |
public void shouldGenerateGeoIndexName() { | |
final Index index = new Index(new Index.GeoKey("x")); | |
assertEquals("x_2d", index.getName()); | |
} | |
@Test | |
public void shouldCompoundIndexName() { | |
final Index index = new Index(new Index.OrderedKey("x", OrderBy.ASC), | |
new Index.OrderedKey("y", OrderBy.ASC), | |
new Index.OrderedKey("a", OrderBy.ASC)); | |
assertEquals("x_1_y_1_a_1", index.getName()); | |
} | |
@Test | |
public void shouldGenerateGeoAndSortedCompoundIndexName() { | |
final Index index = new Index(new Index.GeoKey("x"), | |
new Index.OrderedKey("y", OrderBy.DESC)); | |
assertEquals("x_2d_y_-1", index.getName()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment