/src/test/java/com/googlecode/charts4j/parameters/AxisTypesParameterTest.java

http://charts4j.googlecode.com/ · Java · 79 lines · 40 code · 11 blank · 28 comment · 0 complexity · 87afcd5ff89dc46f2a42cfd4b7724dea MD5 · raw file

  1. /**
  2. *
  3. * The MIT License
  4. *
  5. * Copyright (c) 2011 the original author or authors.
  6. *
  7. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8. * of this software and associated documentation files (the "Software"), to deal
  9. * in the Software without restriction, including without limitation the rights
  10. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the Software is
  12. * furnished to do so, subject to the following conditions:
  13. * The above copyright notice and this permission notice shall be included in
  14. * all copies or substantial portions of the Software.
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. * THE SOFTWARE.
  22. */
  23. package com.googlecode.charts4j.parameters;
  24. import static org.junit.Assert.assertEquals;
  25. import java.util.logging.Level;
  26. import java.util.logging.Logger;
  27. import org.junit.After;
  28. import org.junit.AfterClass;
  29. import org.junit.Before;
  30. import org.junit.BeforeClass;
  31. import org.junit.Test;
  32. /**
  33. *
  34. * @author Julien Chastang (julien.c.chastang at gmail dot com)
  35. */
  36. public class AxisTypesParameterTest {
  37. @BeforeClass
  38. public static void setUpBeforeClass() throws Exception {
  39. Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).setLevel(Level.ALL);
  40. }
  41. @AfterClass
  42. public static void tearDownAfterClass() throws Exception {
  43. }
  44. @Before
  45. public void setUp() throws Exception {
  46. }
  47. @After
  48. public void tearDown() throws Exception {
  49. }
  50. @Test
  51. public void test0() {
  52. final AxisTypesParameter p = new AxisTypesParameter();
  53. p.addAxisTypes(AxisTypes.BOTTOM_X_AXIS);
  54. p.addAxisTypes(AxisTypes.TOP_X_AXIS);
  55. Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(p.toURLParameterString());
  56. final String expectedString = "chxt=x,t";
  57. assertEquals("Junit error", expectedString, p.toURLParameterString());
  58. }
  59. @Test
  60. public void test1() {
  61. final AxisTypesParameter p = new AxisTypesParameter();
  62. Logger.getLogger(Logger.GLOBAL_LOGGER_NAME).info(p.toURLParameterString());
  63. final String expectedString = "";
  64. assertEquals("Junit error", expectedString, p.toURLParameterString());
  65. }
  66. }