Search in sources :

Example 1 with DontRepeat

use of tech.sirwellington.alchemy.test.junit.runners.DontRepeat in project aroma-data-operations by RedRoma.

the class CassandraInboxRepositoryTest method testSaveMessageForUserWithBadArgs.

@DontRepeat
@Test
public void testSaveMessageForUserWithBadArgs() throws Exception {
    User userWithBadId = new User(user).setUserId(badId);
    assertThrows(() -> instance.saveMessageForUser(userWithBadId, message, lifetime)).isInstanceOf(InvalidArgumentException.class);
    Message messageWithBadId = new Message(message).setMessageId(badId);
    assertThrows(() -> instance.saveMessageForUser(user, messageWithBadId, lifetime)).isInstanceOf(InvalidArgumentException.class);
    Message messageWithBadAppId = new Message(message).setApplicationId(badId);
    assertThrows(() -> instance.saveMessageForUser(user, messageWithBadAppId, lifetime)).isInstanceOf(InvalidArgumentException.class);
}
Also used : User(tech.aroma.thrift.User) Message(tech.aroma.thrift.Message) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 2 with DontRepeat

use of tech.sirwellington.alchemy.test.junit.runners.DontRepeat in project aroma-data-operations by RedRoma.

the class CassandraMediaRepositoryTest method testSaveMediaWithBadArgs.

@DontRepeat
@Test
public void testSaveMediaWithBadArgs() throws Exception {
    // Missing media id
    assertThrows(() -> instance.saveMedia("", image)).isInstanceOf(InvalidArgumentException.class);
    // Missing Image
    assertThrows(() -> instance.saveMedia(mediaId, null)).isInstanceOf(InvalidArgumentException.class);
    // bad Id
    assertThrows(() -> instance.saveMedia(badId, image)).isInstanceOf(InvalidArgumentException.class);
    // Empty Image
    Image emptyImage = new Image();
    assertThrows(() -> instance.saveMedia(badId, emptyImage)).isInstanceOf(InvalidArgumentException.class);
}
Also used : Image(tech.aroma.thrift.Image) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 3 with DontRepeat

use of tech.sirwellington.alchemy.test.junit.runners.DontRepeat in project aroma-data-operations by RedRoma.

the class MemoryApplicationRepositoryTest method testGetApplicationOwnedByWhenNoneOwned.

@DontRepeat
@Test
public void testGetApplicationOwnedByWhenNoneOwned() throws Exception {
    User user = one(pojos(User.class));
    List<Application> result = instance.getApplicationsOwnedBy(user.userId);
    assertThat(result, notNullValue());
    assertThat(result, is(empty()));
}
Also used : User(tech.aroma.thrift.User) Application(tech.aroma.thrift.Application) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 4 with DontRepeat

use of tech.sirwellington.alchemy.test.junit.runners.DontRepeat in project aroma-data-operations by RedRoma.

the class MemoryApplicationRepositoryTest method testSaveApplicationWithBadArguments.

@DontRepeat
@Test
public void testSaveApplicationWithBadArguments() throws Exception {
    assertThrows(() -> instance.saveApplication(null)).isInstanceOf(InvalidArgumentException.class);
    Application emptyApplication = new Application();
    assertThrows(() -> instance.saveApplication(emptyApplication)).isInstanceOf(InvalidArgumentException.class);
}
Also used : Application(tech.aroma.thrift.Application) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 5 with DontRepeat

use of tech.sirwellington.alchemy.test.junit.runners.DontRepeat in project aroma-data-operations by RedRoma.

the class MeasuredUserRepositoryTest method testDeleteUserWhenThrows.

@DontRepeat
@Test
public void testDeleteUserWhenThrows() throws Exception {
    doThrow(new UserDoesNotExistException()).when(delegate).deleteUser(userId);
    assertThrows(() -> instance.deleteUser(userId)).isInstanceOf(UserDoesNotExistException.class);
    verify(delegate).deleteUser(userId);
}
Also used : UserDoesNotExistException(tech.aroma.thrift.exceptions.UserDoesNotExistException) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Aggregations

DontRepeat (tech.sirwellington.alchemy.test.junit.runners.DontRepeat)21 Test (org.junit.Test)20 OperationFailedException (tech.aroma.thrift.exceptions.OperationFailedException)6 Message (tech.aroma.thrift.Message)4 User (tech.aroma.thrift.User)4 UserDoesNotExistException (tech.aroma.thrift.exceptions.UserDoesNotExistException)3 Application (tech.aroma.thrift.Application)2 Organization (tech.aroma.thrift.Organization)2 UUID.fromString (java.util.UUID.fromString)1 Image (tech.aroma.thrift.Image)1 ApplicationDoesNotExistException (tech.aroma.thrift.exceptions.ApplicationDoesNotExistException)1 IntegrationTest (tech.sirwellington.alchemy.annotations.testing.IntegrationTest)1 TimeSensitive (tech.sirwellington.alchemy.annotations.testing.TimeSensitive)1 StringGenerators.alphabeticString (tech.sirwellington.alchemy.generator.StringGenerators.alphabeticString)1 GenerateString (tech.sirwellington.alchemy.test.junit.runners.GenerateString)1