@Test
  public void shouldUseLatestMonthDataIfCurrentMonthDataNotAvailable() throws Exception {
    List<MonthSummaryDatum> monthlySummaries =
        asList(
            new MonthSummaryDatum("6", "2012", "2", "2", asList("123", "456")),
            new MonthSummaryDatum("8", "2012", "2", "4", asList("321", "654")));
    Report iudReport = new Report("IUD", "40", new Gson().toJson(monthlySummaries));
    when(allReports.allFor(FPS.indicators())).thenReturn(asList(iudReport));

    String indicatorReports = controller.get();

    IndicatorReport iud = new IndicatorReport("IUD", "IUD Adoption", "40", "0", "10", "2012", "4");
    String expectedIndicatorReports =
        new Gson().toJson(new CategoryReports("Family Planning Services", asList(iud)));
    assertEquals(expectedIndicatorReports, indicatorReports);
  }
示例#2
0
  public Boot() {
    beginSession();

    game_state = 0; // 0 is start, 1 is play, 2 is end;
    start = new Start();
    play = new Play();
    end = new End();

    paddleWidth = 64;
    paddleHeight = 128;
    plX = 150;
    plY = 278;
    prX = 1700;
    prY = 277;

    ballRadius = 20;
    ballSides = 15;
    ballX = Display.getWidth() / 2;
    ballY = 360;
    ballSpeed = 1.5f;

    Texture paddle = loadTexture("res/paddle.png", "PNG");

    // sfx1 = new SoundPlayer("/res/ball1.mp3");
    // sfx1.play();

    /// loading sounds ////
    // each sound creates new thread
    sfx = new HashMap<String, SoundPlayer>();
    sfx.put("ball1", new SoundPlayer("/res/ball1.mp3"));
    sfx.put("ball2", new SoundPlayer("/res/ball2.mp3"));
    sfx.put("clapping", new SoundPlayer("/res/clapping.mp3"));
    sfx.put("booing", new SoundPlayer("/res/booing.mp3"));
    sfx.put("slot_machine", new SoundPlayer("/res/slot_machine.mp3"));
    sfx.put("score", new SoundPlayer("/res/score.mp3"));
    sfx.put("round", new SoundPlayer("/res/round.mp3"));
    /////////

    sfx.get("ball1").play();

    /////////

    splash = new Splashscreen();
    scores = new Scoreboard(3, 2); // pointsPerGame, rounds

    paddleLeft = new Paddle(paddle, plX, plY, paddleWidth, paddleHeight);
    paddleRight = new Paddle(paddle, prX, prY, paddleWidth, paddleHeight);
    pong = new Ball(ballRadius, ballSides, ballSpeed, ballX, ballY);
    // testPong = new Ball(20,15,1.5f,900,600);

    while (!shutdown) {
      Clock.update();

      isEscapePressed(); // checks for escape key, shuts down if so

      glClear(
          GL_COLOR_BUFFER_BIT
              | GL_DEPTH_BUFFER_BIT); // clears screen each time.. don't need this if drawing
                                      // background

      drawNet();

      if (game_state == 1) { // play state
        play.updateState();
        play.drawState();
      } else if (game_state == 2) { // end game state
        end.updateState();
        end.drawState();
      } else { // start state
        start.updateState();
      }

      //////////////////////////

      Display.update();
      Display.sync(60);

      FPS.update(); // count frames per second
      ////////////////////////////////////////////////

      // System.out.println("Delta: " + Clock.getDelta() + ",FPS: " + FPS.getFPS());
    }

    Display.destroy();
  }
 @Before
 public void setUp() throws Exception {
   initMocks(this);
   DateUtil.fakeIt(LocalDate.parse("2012-10-10"));
   controller = new ReportIndicatorListViewController(context, allReports, FPS.value());
 }