Search in sources :

Example 11 with DontRepeat

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

the class MeasuredApplicationRepositoryTest method testGetRecentlyCreatedWhenThrows.

@DontRepeat
@Test
public void testGetRecentlyCreatedWhenThrows() throws Exception {
    when(delegate.getRecentlyCreated()).thenThrow(new OperationFailedException());
    assertThrows(() -> instance.getRecentlyCreated()).isInstanceOf(OperationFailedException.class);
}
Also used : OperationFailedException(tech.aroma.thrift.exceptions.OperationFailedException) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 12 with DontRepeat

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

the class MemoryInboxRepositoryTest method testSaveMessageForUserWithBadArguments.

@DontRepeat
public void testSaveMessageForUserWithBadArguments() throws Exception {
    assertThrows(() -> instance.saveMessageForUser(null, message)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.saveMessageForUser(user, null)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.saveMessageForUser(new User(), message)).isInstanceOf(InvalidArgumentException.class);
    assertThrows(() -> instance.saveMessageForUser(user, new Message())).isInstanceOf(InvalidArgumentException.class);
}
Also used : User(tech.aroma.thrift.User) Message(tech.aroma.thrift.Message) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 13 with DontRepeat

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

the class CassandraApplicationRepositoryTest method testDeleteApplicationWithBadArgs.

@DontRepeat
@Test
public void testDeleteApplicationWithBadArgs() throws Exception {
    String empty = "";
    assertThrows(() -> instance.deleteApplication(empty)).isInstanceOf(InvalidArgumentException.class);
    String badId = one(alphabeticString());
    assertThrows(() -> instance.deleteApplication(badId)).isInstanceOf(InvalidArgumentException.class);
}
Also used : StringGenerators.alphabeticString(tech.sirwellington.alchemy.generator.StringGenerators.alphabeticString) UUID.fromString(java.util.UUID.fromString) GenerateString(tech.sirwellington.alchemy.test.junit.runners.GenerateString) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 14 with DontRepeat

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

the class RequestAssertionsTest method testValidMessageWithBadMessages.

@DontRepeat
@Test
public void testValidMessageWithBadMessages() {
    AlchemyAssertion<Message> assertion = RequestAssertions.validMessage();
    assertThrows(() -> assertion.check(null)).isInstanceOf(FailedAssertionException.class);
    Message emptyMessage = new Message();
    assertThrows(() -> assertion.check(emptyMessage)).isInstanceOf(FailedAssertionException.class);
    Message messageWithoutTitle = emptyMessage.setMessageId(one(uuids));
    assertThrows(() -> assertion.check(messageWithoutTitle)).isInstanceOf(FailedAssertionException.class);
    Message messageWithInvalidId = new Message(message).setMessageId(invalidId);
    assertThrows(() -> assertion.check(messageWithInvalidId)).isInstanceOf(FailedAssertionException.class);
    Message messageWithInvalidAppId = new Message(message).setApplicationId(invalidId);
    assertThrows(() -> assertion.check(messageWithInvalidAppId)).isInstanceOf(FailedAssertionException.class);
}
Also used : Message(tech.aroma.thrift.Message) Test(org.junit.Test) DontRepeat(tech.sirwellington.alchemy.test.junit.runners.DontRepeat)

Example 15 with DontRepeat

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

the class CassandraOrganizationRepositoryIT method testSaveOrganizationTwice.

@DontRepeat
@TimeSensitive
@Test
public void testSaveOrganizationTwice() throws Exception {
    instance.saveOrganization(org);
    Thread.sleep(5);
    instance.saveOrganization(org);
    Organization result = instance.getOrganization(orgId);
    assertMostlyMatch(result, org);
}
Also used : Organization(tech.aroma.thrift.Organization) IntegrationTest(tech.sirwellington.alchemy.annotations.testing.IntegrationTest) Test(org.junit.Test) TimeSensitive(tech.sirwellington.alchemy.annotations.testing.TimeSensitive) 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