Search in sources :

Example 21 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingOrMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingOrMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().or(A_CLASS_MATCHER).orAtLast(A_DEPENDENCY_MATCHER).build();
    // then
    assertEquals(OR, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(OR.name()));
    assertTrue(actual.getName().contains(REGEX));
    assertTrue(actual.getName().contains(NAME));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 22 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingClassMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingClassMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().classNamePattern(REGEX).build();
    // then
    assertEquals(CLASS, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(REGEX));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 23 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingNotMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingNotMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().not(A_CLASS_MATCHER).build();
    // then
    assertEquals(NOT, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(NOT.name()));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 24 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class MissionHealthCheckMatcherBuilderTest method testBuilderShouldAllowBuildingSystemPropertyMatcherWhenCalledWithValidInput.

@Test
void testBuilderShouldAllowBuildingSystemPropertyMatcherWhenCalledWithValidInput() {
    // given
    // when
    final MissionHealthCheckMatcher actual = MissionHealthCheckMatcherBuilder.builder().property(NAME).valuePattern(REGEX).build();
    // then
    assertEquals(PROPERTY, actual.getMatchCriteria());
    assertTrue(actual.getName().contains(NAME));
    assertTrue(actual.getName().contains(REGEX));
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) Test(org.junit.jupiter.api.Test)

Example 25 with MissionHealthCheckMatcher

use of com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher in project abort-mission by nagyesta.

the class NotMatcherTest method testMatchesShouldThrowExceptionWhenCalledWithUnsupportedInput.

@ParameterizedTest
@NullSource
@MethodSource("unsupportedComponentProvider")
void testMatchesShouldThrowExceptionWhenCalledWithUnsupportedInput(final Object invalidInput) {
    // given
    final MissionHealthCheckMatcher underTest = MissionHealthCheckMatcherBuilder.builder().not(STRING_MATCHER).build();
    // when
    final boolean actual = underTest.matches(invalidInput);
    // then
    assertTrue(actual);
}
Also used : MissionHealthCheckMatcher(com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource) NullSource(org.junit.jupiter.params.provider.NullSource)

Aggregations

MissionHealthCheckMatcher (com.github.nagyesta.abortmission.core.matcher.MissionHealthCheckMatcher)47 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)29 MethodSource (org.junit.jupiter.params.provider.MethodSource)21 Test (org.junit.jupiter.api.Test)15 Registry (java.rmi.registry.Registry)7 StageTimeMeasurement (com.github.nagyesta.abortmission.core.telemetry.StageTimeMeasurement)5 MissionHealthCheckEvaluator (com.github.nagyesta.abortmission.core.healthcheck.MissionHealthCheckEvaluator)4 LaunchStatisticsService (com.github.nagyesta.abortmission.strongback.rmi.service.LaunchStatisticsService)3 RemoteException (java.rmi.RemoteException)3 NullSource (org.junit.jupiter.params.provider.NullSource)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 InOrder (org.mockito.InOrder)3 TagDependencyNameExtractor (com.github.nagyesta.abortmission.booster.jupiter.extractor.TagDependencyNameExtractor)2 DependencyNameExtractor (com.github.nagyesta.abortmission.core.extractor.DependencyNameExtractor)2 StringDependencyNameExtractor (com.github.nagyesta.abortmission.core.extractor.impl.StringDependencyNameExtractor)2 StageStatisticsCollectorFactory (com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsCollectorFactory)2 StageStatisticsSnapshot (com.github.nagyesta.abortmission.core.healthcheck.StageStatisticsSnapshot)2 MissionStatisticsCollector (com.github.nagyesta.abortmission.core.healthcheck.impl.MissionStatisticsCollector)2 HashMap (java.util.HashMap)2 Consumer (java.util.function.Consumer)2