Ignore:
Timestamp:
Jul 23, 2025, 10:16:55 AM (2 months ago)
Author:
ruud
Message:

Modifications for automatic java to python conversion. Overloaded methods now have different names.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exampleparties/randompartypy/src/test/java/geniusweb/exampleparties/randompartypy/RandomPartyTest.java

    r52 r54  
    99
    1010import java.io.IOException;
     11import java.io.InputStream;
    1112import java.math.BigDecimal;
    1213import java.net.URI;
    1314import java.net.URISyntaxException;
    14 import java.nio.charset.StandardCharsets;
    15 import java.nio.file.Files;
    16 import java.nio.file.Paths;
     15import java.util.Collections;
    1716import java.util.LinkedList;
    1817import java.util.List;
    1918
     19import org.eclipse.jdt.annotation.NonNull;
    2020import org.junit.Before;
    2121import org.junit.Test;
     
    5252public class RandomPartyTest {
    5353
    54         private static final String PROFILE = "src/test/resources/testprofile.json";
     54        private static final String PROFILE = "/geniusweb/exampleparties/randompartypy/testprofile.json";
    5555        private static final String SAOP = "SAOP";
    5656        private static final PartyId otherparty = new PartyId("other");
     
    6262        private final ProgressRounds progress = mock(ProgressRounds.class);
    6363        private Settings settings;
    64         private final Parameters parameters = new Parameters();
     64        private final Parameters parameters = new Parameters(null);
    6565
    6666        private LinearAdditive profile; // the real profile
     
    7878                };
    7979                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));
    8483                profile = (LinearAdditive) jackson.readValue(serialized, Profile.class);
    8584
     
    139138                party.notifyChange(settings);
    140139
    141                 party.notifyChange(new Finished(new Agreements()));
     140                party.notifyChange(
     141                                new Finished(new Agreements(Collections.emptyMap())));
    142142
    143143                // party should not act at this point
     
    193193        }
    194194
     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        }
    195209}
    196210
Note: See TracChangeset for help on using the changeset viewer.