Changeset 2 for issuevalue/src/test


Ignore:
Timestamp:
08/28/19 11:35:52 (5 years ago)
Author:
bart
Message:

Added new parties : linear, hardliner, conceder, boulware

Location:
issuevalue/src/test/java/geniusweb/issuevalue
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • issuevalue/src/test/java/geniusweb/issuevalue/DomainTest.java

    r1 r2  
    2121import com.fasterxml.jackson.databind.ObjectMapper;
    2222
    23 import geniusweb.issuevalue.Bid;
    24 import geniusweb.issuevalue.DiscreteValue;
    25 import geniusweb.issuevalue.DiscreteValueSet;
    26 import geniusweb.issuevalue.Domain;
    27 import geniusweb.issuevalue.NumberValue;
    28 import geniusweb.issuevalue.NumberValueSet;
    29 import geniusweb.issuevalue.ValueSet;
    3023import tudelft.utilities.junit.GeneralTests;
    3124
     
    3831        private static final String ISSUE3 = "issue3";
    3932        private static final ObjectMapper jackson = new ObjectMapper();
    40         private static final String domainstring = "{\"name\":\"testdomain\",\"issuesValues\":{\"issue2\":{\"range\":[\"2\",\"3\",\"0.22\"]},\"issue1\":{\"values\":[\"i1v1\",\"i1v2\"]}}}";
     33        private static final String domainstring = "{\"name\":\"testdomain\",\"issuesValues\":{\"issue2\":{\"range\":[2,3,0.22]},\"issue1\":{\"values\":[\"i1v1\",\"i1v2\"]}}}";
    4134
    42         private static final String jobsstring = "{\"name\":\"jobs\","
    43                         + "\"issuesValues\":{"
    44                         + "\"lease car\":{\"values\":[\"yes\",\"no\"]},"
    45                         + "\"permanent contract\":{\"values\":[\"yes\",\"no\"]},"
     35        private static final String jobsstring = "{\"name\":\"jobs\"," + "\"issuesValues\":{"
     36                        + "\"lease car\":{\"values\":[\"yes\",\"no\"]}," + "\"permanent contract\":{\"values\":[\"yes\",\"no\"]},"
    4637                        + "\"career development opportunities\":{\"values\":[\"low\",\"medium\",\"high\"]},"
    4738                        + "\"fte\":{\"values\":[\"0.6\",\"0.8\",\"1.0\"]},"
     
    7364                Map<String, ValueSet> issues1 = new HashMap<>();
    7465                issues1.put(ISSUE1, values1);
    75                 issues1.put(ISSUE2, new NumberValueSet(BigDecimal.ONE, TWO,
    76                                 new BigDecimal("0.22")));
     66                issues1.put(ISSUE2, new NumberValueSet(BigDecimal.ONE, TWO, new BigDecimal("0.22")));
    7767                domain3 = new Domain(DOMAINNAME, issues1);
    7868
     
    8171        @Override
    8272        public List<List<Domain>> getGeneralTestData() {
    83                 return Arrays.asList(Arrays.asList(domain, domain1),
    84                                 Arrays.asList(domain2), Arrays.asList(domain3));
     73                return Arrays.asList(Arrays.asList(domain, domain1), Arrays.asList(domain2), Arrays.asList(domain3));
    8574        }
    8675
    8776        @Override
    8877        public List<String> getGeneralTestStrings() {
    89                 return Arrays.asList("Domain.*testdomain.*", "Domain.*testdomain1.*",
    90                                 "Domain.*testdomain.*");
     78                return Arrays.asList("Domain.*testdomain.*", "Domain.*testdomain1.*", "Domain.*testdomain.*");
    9179        }
    9280
     
    10997                System.out.println(jobsstring);
    11098                Domain jobsdomain = jackson.readValue(jobsstring, Domain.class);
    111                 assertEquals(new HashSet<>(Arrays.asList("lease car",
    112                                 "permanent contract", "career development opportunities", "fte",
    113                                 "salary", "work from home")), jobsdomain.getIssues());
     99                assertEquals(new HashSet<>(Arrays.asList("lease car", "permanent contract", "career development opportunities",
     100                                "fte", "salary", "work from home")), jobsdomain.getIssues());
    114101
    115102        }
     
    134121        public void testIsCompleteNoIssuesDefined() {
    135122                Bid bid = mock(Bid.class);
    136                 assertThat(domain.isComplete(bid), new PatternMatch(
    137                                 "Issues in bid .* do not match issues in domain .*"));
     123                assertThat(domain.isComplete(bid), new PatternMatch("Issues in bid .* do not match issues in domain .*"));
    138124        }
    139125
     
    154140                // THREE is NOT a possible value in the NumberValueSet.
    155141                when(bid.getValue(ISSUE2)).thenReturn(new NumberValue(THREE));
    156                 assertThat(domain.isComplete(bid),
    157                                 new PatternMatch("bid issue issue2 has illegal value 3"));
     142                assertThat(domain.isComplete(bid), new PatternMatch("bid issue issue2 has illegal value 3"));
    158143        }
    159144
     
    167152                // THREE is NOT a possible value in the NumberValueSet.
    168153                when(bid.getValue(ISSUE2)).thenReturn(new NumberValue(THREE));
    169                 assertThat(domain.isComplete(bid), new PatternMatch(
    170                                 "Issues in bid .* do not match issues in domain .*"));
     154                assertThat(domain.isComplete(bid), new PatternMatch("Issues in bid .* do not match issues in domain .*"));
    171155        }
    172156
  • issuevalue/src/test/java/geniusweb/issuevalue/NumberValueSetTest.java

    r1 r2  
    1616import com.fasterxml.jackson.databind.ObjectMapper;
    1717
    18 import geniusweb.issuevalue.NumberValue;
    19 import geniusweb.issuevalue.NumberValueSet;
    20 import geniusweb.issuevalue.ValueSet;
    2118import tudelft.utilities.immutablelist.Range;
    2219
     
    3330                        new BigDecimal("0.1"));
    3431
    35         private final String asString = "{\"range\":[\"12.2\",\"12.6\",\"0.3\"]}";
     32        private final String asString = "{\"range\":[12.2,12.6,0.3]}";
    3633        private final static NumberValueSet bigset = new NumberValueSet(BigDecimal.ZERO, BigDecimal.TEN,
    3734                        new BigDecimal("0.00003"));
Note: See TracChangeset for help on using the changeset viewer.