Skip to content

Commit

Permalink
Use actual getDebugMode for check in primespecies finder.
Browse files Browse the repository at this point in the history
  • Loading branch information
smithkm committed Jul 22, 2024
1 parent f412f94 commit 7314fe0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.InvocationTargetException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand Down Expand Up @@ -337,12 +338,19 @@ protected List<S> findPrimarySpecies(Collection<S> allSpecies) {
// There's only one
result.addAll(combined.values());
} else {
var NDEBUG_22 = false;
if (NDEBUG_22) {
// TODO
throw new UnsupportedOperationException();
} else {
switch (this.getDebugMode(22)) {
case 0:
combined.values().stream().sorted(PERCENT_GENUS_DESCENDING).limit(2).forEach(result::add);
break;
case 1:
// TODO
throw new UnsupportedOperationException(
MessageFormat.format("Debug flag 22 value of {0} is not supported", this.getDebugMode(22))
);
default:
throw new IllegalStateException(
MessageFormat.format("Debug flag 22 value of {0} is unknown", this.getDebugMode(22))
);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,8 @@ void testErrorOpeningFile() throws IOException, ResourceParseException {
protected VdypStartApplication getTestUnit(IMocksControl control) throws IOException {

VdypStartApplication mock = EasyMock.createMockBuilder(VdypStartApplication.class)//
.addMockedMethods("getControlFileParser", "process", "getId", "copySpecies")//
.addMockedMethods("getControlFileParser", "process", "getId", "copySpecies", "getDebugMode")//
.createMock(control);

return mock;
}

Expand Down Expand Up @@ -440,6 +439,7 @@ void testSort() throws Exception {
EasyMock.expect(app.copySpecies(EasyMock.same(spec1), EasyMock.capture(copyCapture))).andReturn(spec1);
EasyMock.expect(app.copySpecies(EasyMock.same(spec2), EasyMock.capture(copyCapture))).andReturn(spec2);
EasyMock.expect(app.copySpecies(EasyMock.same(spec3), EasyMock.capture(copyCapture))).andReturn(spec3);
EasyMock.expect(app.getDebugMode(22)).andStubReturn(0);
mockControl.replay();

var allSpecies = List.of(spec1, spec2, spec3);
Expand Down

0 comments on commit 7314fe0

Please sign in to comment.