Changeset 54 for exampleparties/randompartypy/src/test/java
- Timestamp:
- Jul 23, 2025, 10:16:55 AM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
exampleparties/randompartypy/src/test/java/geniusweb/exampleparties/randompartypy/RandomPartyTest.java
r52 r54 9 9 10 10 import java.io.IOException; 11 import java.io.InputStream; 11 12 import java.math.BigDecimal; 12 13 import java.net.URI; 13 14 import java.net.URISyntaxException; 14 import java.nio.charset.StandardCharsets; 15 import java.nio.file.Files; 16 import java.nio.file.Paths; 15 import java.util.Collections; 17 16 import java.util.LinkedList; 18 17 import java.util.List; 19 18 19 import org.eclipse.jdt.annotation.NonNull; 20 20 import org.junit.Before; 21 21 import org.junit.Test; … … 52 52 public class RandomPartyTest { 53 53 54 private static final String PROFILE = " src/test/resources/testprofile.json";54 private static final String PROFILE = "/geniusweb/exampleparties/randompartypy/testprofile.json"; 55 55 private static final String SAOP = "SAOP"; 56 56 private static final PartyId otherparty = new PartyId("other"); … … 62 62 private final ProgressRounds progress = mock(ProgressRounds.class); 63 63 private Settings settings; 64 private final Parameters parameters = new Parameters( );64 private final Parameters parameters = new Parameters(null); 65 65 66 66 private LinearAdditive profile; // the real profile … … 78 78 }; 79 79 settings = new Settings(new PartyId("party1"), 80 new ProfileRef(new URI("file:" + PROFILE)), protocol, progress, 81 parameters); 82 String serialized = new String(Files.readAllBytes(Paths.get(PROFILE)), 83 StandardCharsets.UTF_8); 80 new ProfileRef(new URI("classpath:" + PROFILE)), protocol, 81 progress, parameters); 82 String serialized = read(getClass().getResourceAsStream(PROFILE)); 84 83 profile = (LinearAdditive) jackson.readValue(serialized, Profile.class); 85 84 … … 139 138 party.notifyChange(settings); 140 139 141 party.notifyChange(new Finished(new Agreements())); 140 party.notifyChange( 141 new Finished(new Agreements(Collections.emptyMap()))); 142 142 143 143 // party should not act at this point … … 193 193 } 194 194 195 /** 196 * 197 * @param stream an InputStream 198 * @return all chars from stream 199 * @throws IOException if read fails 200 */ 201 private static @NonNull String read(final @NonNull InputStream stream) 202 throws IOException { 203 @NonNull 204 String res = ""; 205 for (int ch; (ch = stream.read()) != -1;) 206 res = res + (char) ch; 207 return res; 208 } 195 209 } 196 210
Note:
See TracChangeset
for help on using the changeset viewer.