@Test
public void testGetMinimumCodeReviewValue() {
IGerritHudsonTriggerConfig config = Setup.createConfig();
ParameterExpander instance = new ParameterExpander(config);
MemoryImprint memoryImprint = mock(MemoryImprint.class);
MemoryImprint.Entry[] entries = new MemoryImprint.Entry[4];
GerritTrigger trigger = mock(GerritTrigger.class);
when(trigger.getGerritBuildSuccessfulCodeReviewValue()).thenReturn(3);
entries[0] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.SUCCESS);
trigger = mock(GerritTrigger.class);
when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(1);
entries[1] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);
trigger = mock(GerritTrigger.class);
when(trigger.getGerritBuildUnstableCodeReviewValue()).thenReturn(-1);
entries[2] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.UNSTABLE);
trigger = mock(GerritTrigger.class);
when(trigger.getGerritBuildNotBuiltCodeReviewValue()).thenReturn(-4);
entries[3] = Setup.createAndSetupMemoryImprintEntry(trigger, Result.NOT_BUILT);
when(memoryImprint.getEntries()).thenReturn(entries);
// When not all results are NOT_BUILT, we should ignore NOT_BUILT.
int expResult = -1;
int result = instance.getMinimumCodeReviewValue(memoryImprint, true);
assertEquals(expResult, result);