|
| 1 | +package com.alibaba.json.bvt.bug; |
| 2 | + |
| 3 | +import junit.framework.TestCase; |
| 4 | + |
| 5 | +import org.junit.Assert; |
| 6 | + |
| 7 | +import com.alibaba.fastjson.JSON; |
| 8 | + |
| 9 | +public class Issue199 extends TestCase { |
| 10 | + |
| 11 | + public void test_for_issue() throws Exception { |
| 12 | + ConsumeStatus vo = new ConsumeStatus(); |
| 13 | + vo.pullRT = 101.01D; |
| 14 | + vo.pullTPS = 102.01D; |
| 15 | + vo.consumeRT = 103.01D; |
| 16 | + vo.consumeOKTPS = 104.01D; |
| 17 | + vo.consumeFailedTPS = 105.01D; |
| 18 | + |
| 19 | + String text = JSON.toJSONString(vo); |
| 20 | + ConsumeStatus vo1 = JSON.parseObject(text, ConsumeStatus.class); |
| 21 | + Assert.assertTrue(vo.pullRT == vo1.pullRT); |
| 22 | + Assert.assertTrue(vo.pullTPS == vo1.pullTPS); |
| 23 | + Assert.assertTrue(vo.consumeRT == vo1.consumeRT); |
| 24 | + Assert.assertTrue(vo.consumeOKTPS == vo1.consumeOKTPS); |
| 25 | + Assert.assertTrue(vo.consumeFailedTPS == vo1.consumeFailedTPS); |
| 26 | + } |
| 27 | + |
| 28 | + public static class ConsumeStatus { |
| 29 | + |
| 30 | + private double pullRT; |
| 31 | + private double pullTPS; |
| 32 | + private double consumeRT; |
| 33 | + private double consumeOKTPS; |
| 34 | + private double consumeFailedTPS; |
| 35 | + |
| 36 | + public double getPullRT() { |
| 37 | + return pullRT; |
| 38 | + } |
| 39 | + |
| 40 | + public void setPullRT(double pullRT) { |
| 41 | + this.pullRT = pullRT; |
| 42 | + } |
| 43 | + |
| 44 | + public double getPullTPS() { |
| 45 | + return pullTPS; |
| 46 | + } |
| 47 | + |
| 48 | + public void setPullTPS(double pullTPS) { |
| 49 | + this.pullTPS = pullTPS; |
| 50 | + } |
| 51 | + |
| 52 | + public double getConsumeRT() { |
| 53 | + return consumeRT; |
| 54 | + } |
| 55 | + |
| 56 | + public void setConsumeRT(double consumeRT) { |
| 57 | + this.consumeRT = consumeRT; |
| 58 | + } |
| 59 | + |
| 60 | + public double getConsumeOKTPS() { |
| 61 | + return consumeOKTPS; |
| 62 | + } |
| 63 | + |
| 64 | + public void setConsumeOKTPS(double consumeOKTPS) { |
| 65 | + this.consumeOKTPS = consumeOKTPS; |
| 66 | + } |
| 67 | + |
| 68 | + public double getConsumeFailedTPS() { |
| 69 | + return consumeFailedTPS; |
| 70 | + } |
| 71 | + |
| 72 | + public void setConsumeFailedTPS(double consumeFailedTPS) { |
| 73 | + this.consumeFailedTPS = consumeFailedTPS; |
| 74 | + } |
| 75 | + } |
| 76 | +} |
0 commit comments