예제 #1
0
파일: IText.java 프로젝트: RmLtA/Malai
    /**
     * @param token The token to analyse.
     * @return The text size corresponding to the given latex token or null.
     * @since 3.0
     */
    public static TextSize getTextSizeFromToken(final String token) {
      TextSize textSize;

      if (TINY.equals(token)) textSize = TINY;
      else if (FOOTNOTE.equals(token)) textSize = FOOTNOTE;
      else if (HUGE1.equals(token)) textSize = HUGE1;
      else if (HUGE2.equals(token)) textSize = HUGE2;
      else if (LARGE1.equals(token)) textSize = LARGE1;
      else if (LARGE2.equals(token)) textSize = LARGE2;
      else if (LARGE3.equals(token)) textSize = LARGE3;
      else if (NORMAL.equals(token)) textSize = NORMAL;
      else if (SCRIPT.equals(token)) textSize = SCRIPT;
      else if (SMALL.equals(token)) textSize = SMALL;
      else textSize = null;

      return textSize;
    }
  @Test
  public void testGetQuota() throws Exception {
    QuotaInfo infoMock = createMock(QuotaInfo.class);
    expect(quotaManager.getQuotaInfo(ROLE, storageUtil.storeProvider)).andReturn(infoMock);
    expect(infoMock.getQuota()).andReturn(QUOTA);
    expect(infoMock.getProdSharedConsumption()).andReturn(XLARGE);
    expect(infoMock.getProdDedicatedConsumption()).andReturn(LARGE);
    expect(infoMock.getNonProdSharedConsumption()).andReturn(MEDIUM);
    expect(infoMock.getNonProdDedicatedConsumption()).andReturn(SMALL);
    control.replay();

    GetQuotaResult expected =
        new GetQuotaResult()
            .setQuota(QUOTA.newBuilder())
            .setProdSharedConsumption(XLARGE.newBuilder())
            .setProdDedicatedConsumption(LARGE.newBuilder())
            .setNonProdSharedConsumption(MEDIUM.newBuilder())
            .setNonProdDedicatedConsumption(SMALL.newBuilder());

    Response response = assertOkResponse(thrift.getQuota(ROLE));
    assertEquals(expected, response.getResult().getGetQuotaResult());
  }
예제 #3
0
 public int getSize() {
   return (BIG.getSize() + SMALL.getSize()) / 2;
 }