示例#1
0
  @Test
  public void testIsSolution() throws Exception {
    Bucket bucket =
        new Bucket(
            new int[] {14, 10, 6, 2, 8}, new int[] {0, 0, 1, 0, 0}, new int[] {12, 6, 4, 1, 8});

    List<Integer> attributes = new ArrayList<Integer>(5);
    attributes.add(12);
    attributes.add(6);
    attributes.add(4);
    attributes.add(1);

    assert !bucket.isSolution(new Configuration(attributes, "foo"));

    attributes.add(8);

    assert bucket.isSolution(new Configuration(attributes, "foo"));

    attributes.set(4, 7);

    assert !bucket.isSolution(new Configuration(attributes, "foo"));
  }